Plotting multiple equations in one plot

3 vues (au cours des 30 derniers jours)
Gavin Hutchins
Gavin Hutchins le 8 Fév 2022
Commenté : Gavin Hutchins le 10 Fév 2022
I am trying to create my own plot of the following and can't seem to get it right. I can't figure out how to plot the equations for both r and 1/l, I only seem to plot an equation for either r or 1/l.
I used 'linspace' to get an even 100 points for both r and 1/l.
The equations I'm trying to plot are as follows:
V/c = ln(l) - (1/r)*(1-1/l), for V/c = 0.5 & 1
nmax + 1 = r*l, for nmax+1 = 8 & 4
tb/Isp = (1/r)*(1-1/l), for tb/Isp = 1 & 0.5
Any help would be greatly appreciated!
  3 commentaires
Gavin Hutchins
Gavin Hutchins le 8 Fév 2022
My code has changed quite a bit trying to complete this, but this is what I most recently tried.
r = linspace(0,7);
l = linspace(0,1);
V_c = log(1./l)-(1./r).*(1-l);
nmax = r.*(1./l);
tb_Isp = (1./r).*(1-l);
plot(l,V_c)
hold on
plot(l,nmax)
hold on
plot(l,tb_Isp)
I'm not sure how to plot the 3 equations for each of their 2 specified values, also not sure how to get the y-axis to be 'r' and x-axis to be '1/l'
Benjamin Thompson
Benjamin Thompson le 10 Fév 2022
You would use
plot(1./l, r)
The vectors for l and r must be the same length. You cannot have a value of zero in l when you calculate 1/l of course.

Connectez-vous pour commenter.

Réponse acceptée

David Hill
David Hill le 8 Fév 2022
L=.01:.01:1;
count=1;
for v=[.5 1]
r(count,:)=(1-L)./(log(1./L)-v);
count=count+1;
end
for n=[8 4]
r(count,:)=n*L;
count=count+1;
end
for tb=[1 .5]
r(count,:)=(1-L)/tb;
count=count+1;
end
plot(L,r);
  1 commentaire
Gavin Hutchins
Gavin Hutchins le 10 Fév 2022
I appreciate the help, thank you!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Tags

Produits


Version

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by