Error using plot A numeric or double convertible argument is expected

Hello, I have this code, but i can't plot the variable Pw because it says "Error using plot,A numeric or double convertible argument is expected" but 've tried with ezplot, and stems and any of them fix the problem, what i have to do to plot Pw?
t=1e3:100:10e3;
syms p;
%x=-1510:1:1610;
%y=((x.^2)/(41)-1000);
%y1=y*-10;
w1=2e3;
w2=8e3;
A=10;
B=20;
g=parabola1;
%g1=EDFA;
z=100e-6;
%figure(3)
%plot(parabola1)
%fprintf(parabola1);
%axis([1300 1800 0 10e3])
figure(1)
f(t)=A*sin(w1*t)+B*cos(w2*t);
Pi=f(t);
plot(Pi)
figure(2)
%pione=EDFASinglePassGain_Analytical(Pi);
%stem(pione)
Pw=Pi.^(g*z);
plot(Pw)
%figure(4)
%Pw1=Pi.^g1*z;
%plot(Pw1)

回答(2 个)

YOu need to convert your sym varaible to double to plot. Read about double.

2 个评论

i changed the Pw to a double variable but with vpa, but now MATLAB showed me this
Error using inlineeval (line 14)
Error in inline expression ==>
matrix([[(-7254250567604507./281474976710656).^(x./10000),
(-3811115523678241./140737488355328).^(x./10000),
(-7522526733031939./281474976710656).^(x./10000),
(-3486834806029515./140737488355328).^(x./10000),
(-188433272412721./8796093022208).^(x./10000),
(-2388267933480667./140737488355328).^(x./10000),
(-6646677555354303./562949953421312).^(x./10000),
(-1795209592368153./281474976710656).^(x./10000),
(-322176506469167./281474976710656).^(x./10000),
(1942474664897181./562949953421312).^(x./10000),
(3952316566740705./562949953421312).^(x./10000),
(5216458947696533./562949953421312).^(x./10000),
(5628960268291825./562949953421312).^(x./10000),
(161102416862413./17592186044416).^(x./10000),
(3835077823765521./562949953421312).^(x./10000),
(889505247208845./281474976710656).^(x./10000),
(-105038029374677./70368744177664).^(x./10000),
(-7604662473915683./1125899906842624).^(x./10000),
(-6856582513936741./562949953421312).^(x./10000),
(-4871512010249943./281474976710656).^(x./10000),
(-6106634383741553./281474976710656).^(x./10000),
(-439088548699823./17592186044416).^(x./10000),
(-3772203188444611./140737488355328).^(x./10000),
(-3805883081124317./140737488355328).^(x./10000),
(-7211537042223109./281474976710656).^(x./10000),
(-6364988421280329./281474976710656).^(x./10000),
(-2564473601598027./140737488355328).^(x./10000),
(-448905090589489./35184372088832).^(x./10000),
(-931811828098223./140737488355328).^(x./10000),
(-145526725175301./562949953421312).^(x./10000),
(824992005200949./140737488355328).^(x./10000),
(6358352394513547./562949953421312).^(x./10000),
(2202702462215531./140737488355328).^(x./10000),
(327756962675233./17592186044416).^(x./10000),
(5642381163634457./281474976710656).^(x./10000),
(1395791605850521./70368744177664).^(x./10000),
(2543296614419323./140737488355328).^(x./10000),
(2104123776093727./140737488355328).^(x./10000),
(3034580024071739./281474976710656).^(x./10000),
(3351606308855437./562949953421312).^(x./10000),
(2054869364481081./2251799813685248).^(x./10000),
(-2185621130658317./562949953421312).^(x./10000),
(-8999409817804783./1125899906842624).^(x./10000),
(-3107100214119373./281474976710656).^(x./10000),
(-3582348854151071./281474976710656).^(x./10000),
(-3625099978839371./281474976710656).^(x./10000),
(-402590805499291./35184372088832).^(x./10000),
(-4783436202967157./562949953421312).^(x./10000),
(-2391814198997159./562949953421312).^(x./10000),
(69545826140407./70368744177664).^(x./10000),
(7673954683477679./1125899906842624).^(x./10000),
(1799235601471781./140737488355328).^(x./10000),
(2593684370976279./140737488355328).^(x./10000),
(1640198045386495./70368744177664).^(x./10000),
(7610810213320479./281474976710656).^(x./10000),
(2063675487555719./70368744177664).^(x./10000),
(4220833103902183./140737488355328).^(x./10000),
(2039235563864635./70368744177664).^(x./10000),
(1855751797120891./70368744177664).^(x./10000),
(3148876311573639./140737488355328).^(x./10000),
(4869788875504879./281474976710656).^(x./10000),
(6502516405023507./562949953421312).^(x./10000),
(3137482183038381./562949953421312).^(x./10000),
(-94010935525971./562949953421312).^(x./10000),
(-1471643898621289./281474976710656).^(x./10000),
(-2597325177496187./281474976710656).^(x./10000),
(-3341413072837167./281474976710656).^(x./10000),
(-3653154680266045./281474976710656).^(x./10000),
(-3517755377931993./281474976710656).^(x./10000),
(-1478763644364075./140737488355328).^(x./10000),
(-2030018190501933./281474976710656).^(x./10000),
(-3293092924962965./1125899906842624).^(x./10000),
(2205540645344577./1125899906842624).^(x./10000),
(984236037846971./140737488355328).^(x./10000),
(1649304260929071./140737488355328).^(x./10000),
(8838217168189743./562949953421312).^(x./10000),
(5224024542833205./281474976710656).^(x./10000),
(5632833228274845./281474976710656).^(x./10000),
(5597057285985191./281474976710656).^(x./10000),
(319017678527987./17592186044416).^(x./10000),
(2089623378715639./140737488355328).^(x./10000),
(1440952207322019./140737488355328).^(x./10000),
(1302635157810385./281474976710656).^(x./10000),
(-3560206840816129./2251799813685248).^(x./10000),
(-8934155240449147./1125899906842624).^(x./10000),
(-491456273362923./35184372088832).^(x./10000),
(-5414987530082513./281474976710656).^(x./10000),
(-6576097384616239./281474976710656).^(x./10000),
(-7333110979315203./281474976710656).^(x./10000),
(-7636333749706743./281474976710656).^(x./10000),
(-934027937906967./35184372088832).^(x./10000)]])
Undefined function 'matrix' for input
arguments of type 'double'.
Error in inline/feval (line 33)
INLINE_OUT_ =
inlineeval(INLINE_INPUTS_,
INLINE_OBJ_.inputExpr,
INLINE_OBJ_.expr);
Error in ezplotfeval (line 51)
z = feval(f,x(1));
Error in ezplot>ezplot1 (line 472)
[y, f, loopflag] = ezplotfeval(f, x);
Error in ezplot (line 144)
[hp, cax] = ezplot1(cax,
f{1}, vars, labels, args{:});
Error in sym/ezplot (line 61)
h = ezplot(fhandle(f));
Error in tarea2i1 (line 31)
ezplot(Pw)
Give the complete code..let me check it.

请先登录,再进行评论。

Old enough releases cannot ezplot symbolic and need to fplot instead .

6 个评论

now it shows me this
Index exceeds matrix dimensions.
Error in fplot (line 56)
lims = args{2};
Error in tarea2i2 (line 25)
fplot(Pw)
With old enough MATLAB, you need to pass at least two arguments to fplot: the expression to be plotted, and the range to plot over. For example,
fplot(Pw, [-1 1])
Now it shows me this
Error using fcnchk (line 106)
If FUN is a MATLAB object, it must have an feval method.
Error in fplot (line 62)
fun = fcnchk(fun);
Error in tarea2i2 (line 25)
fplot(Pw,[-1 1])
this is my last code
t=1e3:100:10e3;
syms p;
%x=-1510:1:1610;
%y=((x.^2)/(41)-1000);
%y1=y*-10;
w1=2e3;
w2=8e3;
A=10;
B=20;
g=parabola1;
%g1=EDFA;
z=100e-6;
%figure(3)
%plot(parabola1)
%fprintf(parabola1);
%axis([1300 1800 0 10e3])
figure(1)
f(t)=A*sin(w1*t)+B*cos(w2*t);
Pi=f(t);
plot(Pi)
figure(2)
%pione=EDFASinglePassGain_Analytical(Pi);
%stem(pione)
Pw=Pi.^(g*z);
fplot(Pw,[-1 1])
%figure(4)
%Pw1=Pi.^g1*z;
%plot(Pw1)
At the moment it does not make sense to me that you would get that error message. Can you save Pw into a .mat and attach that?

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Formula Manipulation and Simplification 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by