How to plot a nonlinear equation using FSOLVE in MATLAB
Ältere Kommentare anzeigen
Hello
I have a nonlinear equation like this:

in which:
I want to plot
vs. k
obviously this is a nonlinear equation. How should I use FSOLVE to have this plot?
Akzeptierte Antwort
Weitere Antworten (3)
Torsten
am 7 Mai 2019
0 Stimmen
K = 1:627;
kp = 4500;
h = 1.0e-3;
d = 7.5e-3;
ky0 = 1.0;
Ky = zeros(numel(K),1);
%fKy = zeros(numel(K),1);
for i = 1:numel(K)
k = K(i);
fun = @(ky) ky/k*tan(ky*h)+(1-(k^2-ky^2)/(kp^2+k^2-ky^2))*tan(k*d)+(k^2-ky^2)/(kp^2+k^2-ky^2)*sqrt(kp^2-k^2)/k*tan(sqrt(kp^2-ky^2)*d);
Ky(i) = fzero(fun,ky0);
%fKy(i) = fun(Ky(i));
ky0 = Ky(i);
end
plot(K,Ky)
%plot(K,fKy)
mohammaddmt
am 7 Mai 2019
0 Stimmen
3 Kommentare
John D'Errico
am 7 Mai 2019
Please stop adding answers just to make a comment.
John D'Errico
am 7 Mai 2019
Anyway, I just spent what, well over an hour writing a solution to the problem that you posed, i.e., how to use fsolve to plot the solutions of an equation. Since fsolve only returns real solutions, that question was actually irrelevant, as was much of my solution as written.
Is there a good reason why you did not tell us what you really wanted to learn, and thus save me a great deal of time in answering the wrong question?
mohammaddmt
am 7 Mai 2019
Bearbeitet: mohammaddmt
am 7 Mai 2019
Mahmoud Abdelaziz
am 23 Dez. 2019
0 Stimmen
Hi there,
I see an excellent and helpfull answer.
I have a question. Can you help me.
I want to plot some nonlinear inequalities as follows:
R1>0,R2<0,R3>0,R4>0,R5>0,R6>0, where
R1= x*y+2, R2=x-1, R3=x^2*y-x*y-1, R4=x^2*y-x*y+2, R5=x*y+3, R6=x^3*y-4*x^2*y+3*x^2+4*x*y-8*x+8.
If not possible to plot these inequalities and find the region of solutions, Can plot them as equations?
Thank youfor your help.
M. A. M. Abdelaziz.
1 Kommentar
John D'Errico
am 24 Dez. 2019
Bearbeitet: John D'Errico
am 24 Dez. 2019
Ask this as a separate question. What you have posted is not an answer, but a question.
By the way, what you have shown are NOT inequalities, but equalities. There is a difference, a big one. There is no region of solution to what you have posted, where they are equality statements.
Regardless, if you want help, post this as a QUESTION.
Kategorien
Mehr zu Solver Outputs and Iterative Display finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


