Figure 's issue

2 次查看(过去 30 天)
M
M 2022-9-12
编辑: Torsten 2022-9-13
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);

采纳的回答

Walter Roberson
Walter Roberson 2022-9-12
编辑:Walter Roberson 2022-9-12
[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 个评论
Torsten
Torsten 2022-9-12
编辑:Torsten 2022-9-13
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);
M
M 2022-9-12
Yeah, that's true, and I understood what you said, but the point is that only this part ct=[0,2] and h=[0,1] is important for me, and with "plot", it seems to work better (at least for this case).

请先登录,再进行评论。

更多回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by