フィルターのクリア

Operator '.^' is not supported for operands of type 'cell'

1 回表示 (過去 30 日間)
M
M 2022 年 7 月 31 日
コメント済み: Star Strider 2022 年 8 月 1 日
Hi, I wanted to plot lambda which is defined in the code below, but it has an error: Operator '.^' is not supported for operands of type 'cell'.
Could you please tell me how solve this problem and plot lambda?
vplc=0.25;delta=2.5;tau_max=44000;Ktau=0.045;
kc=0.1; kh=0.05;Vp=0.9;K=0.000015;kp=0.15;gamma=5.5;kb=0.4;vss=0.044;
Vpm=0.000159;Kpm=0.15;alpha0=.00000681;alpha1=0.0000227;Ke=7;Vs=0.002;ks=0.1;
Kf=0.18;kplc=0.055;ki=2;gamma=5.5;kipr=0.18;
[c,ct]=meshgrid(0:0.005:1);
p=(vplc./ki).*(c.^2./((kplc).^2+c.^2));
A=(-(vss.*c.^2)./(ks.^2))+((Vs.*K.*gamma.^2.*ct.^2)./(Ktau.^4.*ks.^2))+alpha0+alpha1.*((Ke.^4)./(Ke.^4+(gamma.*ct).^{4}));
h=(-2.*Kc.^2.*Kp^2.*A)./(5.*c.^4.*ct.*gamma.*Kf.*p.^2.*((a.*A)./(5.*ct.*gamma.*Kf))-1);
Po=(p.^2.*c.^4.*h)./(kb.*p.^2.*c.^4.*h+kb.*kp.^2.*kc.^2);
lambda=Kf.*gamma.*ct.*((10.*c.^3.*p.^2.*h.*(c.^4*p.^2.*h+kp.^2.*kc.^2-c.^4.*p.^2.*h))./(c.^4*p.^2.*h+kp.^2.*kc.^2).^2)-(2.*vss.*c/ks.^2);
surf(c,ct,lambda);

採用された回答

Star Strider
Star Strider 2022 年 8 月 1 日
The original problem was caused by using curly brackets {} around the 4:
A=(-(vss.*c.^2)./(ks.^2))+((Vs.*K.*gamma.^2.*ct.^2)./(Ktau.^4.*ks.^2))+alpha0+alpha1.*((Ke.^4)./(Ke.^4+(gamma.*ct).^{4}))
↑ ↑ ← HERE
Also, MATLAB is case-sensitive, so ka~=Ka, a~=A and other instances.
Also, please make your code easier to read. Bunching up several assignments does not make the code more efficient (it might make it less efficient), and it definitely does make it more difficult to read and troubleshoot.
With those (and similar) corrections, this is the result —
vplc=0.25;
delta=2.5;
tau_max=44000;
Ktau=0.045;
Kc=0.1;
kh=0.05;
Vp=0.9;
K=0.000015;
Kp=0.15;
gamma=5.5;
kb=0.4;
vss=0.044;
Vpm=0.000159;
Kpm=0.15;
alpha0=.00000681;
alpha1=0.0000227;
Ke=7;
Vs=0.002;
ks=0.1;
Kf=0.18;
kplc=0.055;
ki=2;
gamma=5.5;
kipr=0.18;
[c,ct]=meshgrid(0:0.005:1);
p=(vplc./ki).*(c.^2./((kplc).^2+c.^2));
A=(-(vss.*c.^2)./(ks.^2))+((Vs.*K.*gamma.^2.*ct.^2)./(Ktau.^4.*ks.^2))+alpha0+alpha1.*((Ke.^4)./(Ke.^4+(gamma.*ct).^4));
h=(-2.*Kc.^2.*Kp^2.*A)./(5.*c.^4.*ct.*gamma.*Kf.*p.^2.*((A.*A)./(5.*ct.*gamma.*Kf))-1);
Po=(p.^2.*c.^4.*h)./(kb.*p.^2.*c.^4.*h+kb.*Kp.^2.*Kc.^2);
lambda=Kf.*gamma.*ct.*((10.*c.^3.*p.^2.*h.*(c.^4*p.^2.*h+Kp.^2.*Kc.^2-c.^4.*p.^2.*h))./(c.^4*p.^2.*h+Kp.^2.*Kc.^2).^2)-(2.*vss.*c/ks.^2);
figure
surf(c,ct,lambda, 'EdgeColor','none')
I have no idea what you are doing, so I defer to you for whatever else needs to be done to get a reasonable result.
.
  2 件のコメント
M
M 2022 年 8 月 1 日
Thank you so much
Star Strider
Star Strider 2022 年 8 月 1 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by