Figure 's issue
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi everyone. I wrote the code below for plotting a 2d figure (ct-h) but it doesn't work; I mean it doesn't show any figure. Could you please tell me what is the problem, and how can I solve it?
Thanks in advance for any help.
vplc=0.16;
delta=0.1;
Ktau=0.045;
Kc=0.1;
K=0.0075;
Kp=0.15;
gamma=5.5;
kb=0.4;
vss=0.044;
alpha0=delta*6.81e-6/(0.002);
alpha1=delta*2.27e-5/(0.002);
Ke=7;
Vs=0.002;
ks=0.1;
Kf=0.18;
kplc=0.055;
ki=2;
[ct]=meshgrid(0.0001:0.05:30);
x=(((2.*Vs.*K.*gamma.^2.*ct.^2)./(vss))+((2.*alpha0.*ks.^2)./(vss))+((2.*Ke.^4.*ks.^2.*alpha1)./(vss.*(Ke.^4+(gamma.*ct).^4))));
p=(vplc./ki).*(x./((kplc).^2+x));
A=(-(vss.*x)./(ks.^2))+((Vs.*K.*gamma.^2.*ct.^2)./(ks.^2))+alpha0+alpha1.*((Ke.^4)./(Ke.^4+(gamma.*ct).^4));
h=-(0.4.*A.*((Kc.^4).*(Kp.^2))./((p.^2.*x.^2.*gamma.*ct.*Kf)));
plot(ct,h);
0 commentaires
Réponse acceptée
Walter Roberson
le 12 Sep 2022
Modifié(e) : Walter Roberson
le 12 Sep 2022
[ct]=meshgrid(0.0001:0.05:30);
is treated the same way as if you had used
[ct, ~]=meshgrid(0.0001:0.05:30, 0.0001:0.05:30);
It creates a 600 x 600 grid that is just a lot of repeats of the same values. So you end up plotting 600 lines.
I suggest you use semilogy instead of plot()
6 commentaires
Torsten
le 12 Sep 2022
Modifié(e) : Torsten
le 13 Sep 2022
With "plot(ct,h)" also worked and gave me the figure that I expected
I only see one small jump at 0 and everything else on the zero level
vplc=0.16;
delta=0.1;
Ktau=0.045;
Kc=0.1;
K=0.0075;
Kp=0.15;
gamma=5.5;
kb=0.4;
vss=0.044;
alpha0=delta*6.81e-6/(0.002);
alpha1=delta*2.27e-5/(0.002);
Ke=7;
Vs=0.002;
ks=0.1;
Kf=0.18;
kplc=0.055;
ki=2;
ct=0.0001:0.05:2;
x=(((2.*Vs.*K.*gamma.^2.*ct.^2)./(vss))+((2.*alpha0.*ks.^2)./(vss))+((2.*Ke.^4.*ks.^2.*alpha1)./(vss.*(Ke.^4+(gamma.*ct).^4))));
p=(vplc./ki).*(x./((kplc).^2+x));
A=(-(vss.*x)./(ks.^2))+((Vs.*K.*gamma.^2.*ct.^2)./(ks.^2))+alpha0+alpha1.*((Ke.^4)./(Ke.^4+(gamma.*ct).^4));
h=-(0.4.*A.*((Kc.^4).*(Kp.^2))./((p.^2.*x.^2.*gamma.*ct.*Kf)));
plot(ct,h);
whereas the semilogy option gives a good resolution of the different scales:
vplc=0.16;
delta=0.1;
Ktau=0.045;
Kc=0.1;
K=0.0075;
Kp=0.15;
gamma=5.5;
kb=0.4;
vss=0.044;
alpha0=delta*6.81e-6/(0.002);
alpha1=delta*2.27e-5/(0.002);
Ke=7;
Vs=0.002;
ks=0.1;
Kf=0.18;
kplc=0.055;
ki=2;
ct=0.0001:0.05:2;
x=(((2.*Vs.*K.*gamma.^2.*ct.^2)./(vss))+((2.*alpha0.*ks.^2)./(vss))+((2.*Ke.^4.*ks.^2.*alpha1)./(vss.*(Ke.^4+(gamma.*ct).^4))));
p=(vplc./ki).*(x./((kplc).^2+x));
A=(-(vss.*x)./(ks.^2))+((Vs.*K.*gamma.^2.*ct.^2)./(ks.^2))+alpha0+alpha1.*((Ke.^4)./(Ke.^4+(gamma.*ct).^4));
h=-(0.4.*A.*((Kc.^4).*(Kp.^2))./((p.^2.*x.^2.*gamma.*ct.*Kf)));
semilogy(ct,h);
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Graphics Objects 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!