Search code examples
matlabmathnonlinear-functions

Graph of non-linear variable on MatLab


I'd like to get a graph (e0, b) from this non-linear function:

C==(2*e0.*pi)/(log(b/a))

I tried that code, but it did not work:

a = 1*10^-3; 
C=0.0001*10^-3;
e0=1:0.1*10^-3:7; 
fsolve(C==(2*e0.*pi)/(log(b/a)),b);
plot(e0,b)

How can I get this graph in MatLab?


Solution

  • There is no graph to be had because e0 = Inf. The reason for this is if you rearrange your equation, you have:

    b = a*exp(2*pi*e0/C);
    

    with e0 between 1 and 7 and C being 1e-7, your values of be will be (ignoring a) between exp(2*pi*1e7) and exp(14*pi*1e7). And guess what?

    >> exp(2*pi*1e7)
    ans = Inf
    

    So either your values are wrong, your equation is wrong or there is no solution.