Matlab Error "X, Y, Z, and C cannot be complex"

2 ビュー (過去 30 日間)
Nikolas Spiliopoulos
Nikolas Spiliopoulos 2020 年 7 月 15 日
回答済み: Walter Roberson 2020 年 7 月 15 日
Hi all,
I am trying to plot a surface however, I get an error "X, Y, Z, and C cannot be complex." which means, apparently there are some xomplex values. However, I put the command to get only the real values and I get a blank graph with no points at all (it is obvious that there are solutions with real values). Couod you help me with that? here is the code
a=0.1735;
b=0.19;
c=0.3283;
d=-0.017;
[I,I_opt] = meshgrid(0.1:0.1:4.67,0.1:0.1:4.67);
Z=exp(0.3524*(I-I_opt))*a*exp(b*I)*(1-a*exp(b*I))/(c*I_opt^d*(1-c*I_opt^d));
redChannel=Z<1;
colors = double(redChannel);
surf(I,I_opt,real(Z),colors)
zlim([0 10])

採用された回答

Walter Roberson
Walter Roberson 2020 年 7 月 15 日
>> Z=exp(0.3524.*(I-I_opt)).*a.*exp(b.*I).*(1-a.*exp(b.*I))./(c.*I_opt.^d.*(1-c.*I_opt.^d));

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by