Conversion to double from sym is not possible

1 回表示 (過去 30 日間)
petter
petter 2011 年 12 月 30 日
Hi every body,
I am a beginner of matlab
this is my code
syms x;
A = [3*x , 0; 0.3*f , 0; 3 , 0; 1 , 0];
for a=1:2
for b=1:2
for c=1:2
for d=1:2
er=A(1,a);
ei=A(2,b);
ur=A(3,c);
ui=A(4,d);
for d=1:3;
x=2:18;
e=er-1i*ei;
u=ur-1i*ui;
z=(abs((d*x)*(e*u)^0.5)));
plot(x,z)
end
end
end
end
end
when I come to plot, I get this message
Conversion to double from sym is not possible
help me please, have a nice life
  1 件のコメント
Andrei Bobrov
Andrei Bobrov 2011 年 12 月 30 日
what is it - 'f'

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

採用された回答

petter
petter 2011 年 12 月 31 日
In the wide and broad world, never contact with each other, you gave me so useful help.
thank you for your timely answer and your discerning observation ('f' from my code, replaced on 'x')
To express my thanks, my function is named after "andrei bobrov".
I am a beginner in matlab. But I will try my best to help others in matlab just like you someday.
thank you again!
  1 件のコメント
Fangjun Jiang
Fangjun Jiang 2011 年 12 月 31 日
So why did you accept your own answer which is not really the solution to your problem? I suggest you delete this answer, add your acknowledgement as a comment and accept andrei's answer.

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

その他の回答 (1 件)

Andrei Bobrov
Andrei Bobrov 2011 年 12 月 30 日
'f', from your code, replaced on 'x'
syms x;
A = [3*x , 0; 0.3*x , 0; 3 , 0; 1 , 0];
for a=1:2
for b=1:2
for c=1:2
for d=1:2
er=A(1,a);
ei=A(2,b);
ur=A(3,c);
ui=A(4,d);
for d1=1:3
x1= 2:18;
e= er-1i*ei;
u= ur-1i*ui;
z = subs(abs(d1*x*e*u^0.5),x,x1) ;
figure;
plot(x1,z)
end
end
end
end
end
  1 件のコメント
Walter Roberson
Walter Roberson 2011 年 12 月 31 日
You probably need to plot(x1,double(z))

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

Community Treasure Hunt

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

Start Hunting!

Translated by