Too many symbolic variables using fplot

1 visualización (últimos 30 días)
Jessica Gerberdolan
Jessica Gerberdolan el 21 de Nov. de 2018
Comentada: madhan ravi el 21 de Nov. de 2018
My code won't plot a graph I think because it says I have too many symbolic variables but I only have t as a symbolic varable. I don't know how to fix this error message, please help!
This is my code:
syms t w_1 w_2 'real'
%creates the symbolic and real variables t w_1 and w_2 in matlab and stores them
x_t = 1.2*cos(w_1*t - 0.85) + 0.35*cos(w_2*t + 0.75)
%creates function pof oscillation
%%part b
w_1 = 0.85
w_2 = 0.20
subs(x_t,{w_1,w_2},{double(0.85),double(0.20)})
%subsitutes the values of w_1 and w_2 with the values I give it
%the double function changes the symbolic varable type to a double variable
%type
fplot(x_t,[0, 130])
This is my error message
Error using fplot>singleFplot (line 229)
Input must be a function or functions of a single
variable.
Error in
fplot>@(f)singleFplot(cax,{f},limits,extraOpts,args)
(line 193)
hObj = cellfun(@(f)
singleFplot(cax,{f},limits,extraOpts,args),fn{1},'UniformOutput',false);
Error in fplot>vectorizeFplot (line 193)
hObj = cellfun(@(f)
singleFplot(cax,{f},limits,extraOpts,args),fn{1},'UniformOutput',false);
Error in fplot (line 163)
hObj =
vectorizeFplot(cax,fn,limits,extraOpts,args);
Error in gerberdolan_jessica_hw10 (line 51)
fplot(x_t,[0, 130])
this is what my whos looks like
t 1x1 8 sym
w_1 1x1 8 double
w_2 1x1 8 double
x_t 1x1 8 sym

Respuesta aceptada

madhan ravi
madhan ravi el 21 de Nov. de 2018
syms t w_1 w_2 real
x_t = 1.2*cos(w_1*t - 0.85) + 0.35*cos(w_2*t + 0.75)
w_1 = 0.85
w_2 = 0.20
x_t=subs(x_t)
fplot(x_t,[0, 130])
  2 comentarios
Jessica Gerberdolan
Jessica Gerberdolan el 21 de Nov. de 2018
It worked! thank you!!!
madhan ravi
madhan ravi el 21 de Nov. de 2018
Anytime :)

Iniciar sesión para comentar.

Más respuestas (0)

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by