Variable into a constsant for a plot

1 visualización (últimos 30 días)
Jack
Jack el 19 de Feb. de 2021
Comentada: Jack el 19 de Feb. de 2021
Hi,
I am trying to plot an equation with two variales but setting one variable as a constant for the plot.
Here is the code i have tried so far:
syms w sol(t)
sol(t) = (1/(400-w^2)) * (sin(w*t) - (w/20)*sin(20*t))
for w=5:10
fplot(sol(t))
hold on
end
hold off
Here is something else I have tried with a simplied version of the problem:
syms y(x) a
y(x) = a*x
a = 1
fplot(y(x))
OR
syms y(x) a
y(x) = a*x
assume(a==1)
fplot(y(x))
Thanks in advance for any help you can give.

Respuesta aceptada

Patrick Haffmans
Patrick Haffmans el 19 de Feb. de 2021
The function you want to use is
subs(s,old,new)
Check out how to use it here
  1 comentario
Jack
Jack el 19 de Feb. de 2021
Thank you patrick.
clear
syms y(x) a
y(x) = a*x
fplot(subs(y,a,3))

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by