필터 지우기
필터 지우기

How to plot this differential equation

조회 수: 1 (최근 30일)
AF
AF 2020년 2월 28일
답변: Andrés Castro 2020년 2월 28일
y=2xC-(C^2)/4
with multiple lines on same graph
any value for C and x except 0
  댓글 수: 1
Walter Roberson
Walter Roberson 2020년 2월 28일
I do not see any differential equation there? It just looks like a linear equation ?

댓글을 달려면 로그인하십시오.

답변 (1개)

Andrés Castro
Andrés Castro 2020년 2월 28일
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

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by