Figure 's issue
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
M
el 12 de Sept. de 2022
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 comentarios
Respuesta aceptada
Walter Roberson
el 12 de Sept. de 2022
Editada: Walter Roberson
el 12 de Sept. de 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 comentarios
Torsten
el 12 de Sept. de 2022
Editada: Torsten
el 13 de Sept. de 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);
Más respuestas (0)
Ver también
Categorías
Más información sobre Graphics Objects en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!