How to plot this differential equation

1 visualización (últimos 30 días)
AF
AF el 28 de Feb. de 2020
Respondida: Andrés Castro el 28 de Feb. de 2020
y=2xC-(C^2)/4
with multiple lines on same graph
any value for C and x except 0
  1 comentario
Walter Roberson
Walter Roberson el 28 de Feb. de 2020
I do not see any differential equation there? It just looks like a linear equation ?

Iniciar sesión para comentar.

Respuestas (1)

Andrés Castro
Andrés Castro el 28 de Feb. de 2020
You can try with the following code:
syms x C % Define the syumbolic constants
y = 2*x*C-(C^2)/4;
constant_vector = -10:10; % stores the values for C = -10,-9...10 you can change it
for i = 1 : length(constant_vector)
f(x) = subs(y,C,constant_vector(i)) % substitutes the numeric values of constant_vector in y(x) function
fplot(@(x) f(x),[-10,10]); % fplot function graphs for ith value of f(x) within -10 to 10 along the x axis
hold on % allows keep the multiple functions in the same window
grid on
end
Obviusly when C = 0, y is 0 for the whole values of x

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by