How to plot a function over an interval of two functions?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
I am trying to plot a symbolic function using fplot. I want to plot the function over an interval of two functions, but it is showing an error ''Too many functions''. Is there a way to solve this problem?
syms v
Ncrn1= 2.5429/v^2 + 0.3251*v^2;
fplot(v,Ncrn1,[0,9],'--')
Ncrn2=5.1624/v^2 + 0.0869*v^2;
fplot(v,Ncrn2,[0,9],'--')
Ncrn3=9.2372/v^2 + 0.0404*v^2;
fplot(v,Ncrn3,[0,9],'--')
hold on
int=solve(Ncrn2-Ncrn1==0,v)
inter1=int(real(int)>0&imag(int)==0);
fplot(v,Ncrn1,[0 inter1],'r','LineWidth',1.5);
hold on
int=solve(Ncrn3-Ncrn2==0,v);
inter2=int(real(int)>0&imag(int)==0);
fplot(v,Ncrn2,[inter1 inter2],'r','LineWidth',1.5);
0 commentaires
Réponse acceptée
Dyuman Joshi
le 13 Avr 2023
Convert the solution obtained by solve() to double.
syms v
Ncrn1= 2.5429/v^2 + 0.3251*v^2;
fplot(v,Ncrn1,[0,9],'--')
Ncrn2=5.1624/v^2 + 0.0869*v^2;
fplot(v,Ncrn2,[0,9],'--')
Ncrn3=9.2372/v^2 + 0.0404*v^2;
fplot(v,Ncrn3,[0,9],'--')
hold on
int=solve(Ncrn2-Ncrn1==0,v);
%Conversion
inter1=double(int(real(int)>0&imag(int)==0))
fplot(v,Ncrn1,[0 inter1],'r','LineWidth',1.5)
hold on
int=solve(Ncrn3-Ncrn2==0,v);
%Conversion
inter2=double(int(real(int)>0&imag(int)==0))
fplot(v,Ncrn2,[inter1 inter2],'r','LineWidth',1.5)
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Assumptions dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!