Figure 's issue

1 回表示 (過去 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 件)

カテゴリ

Help Center および File ExchangeGraphics Objects についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by