フィルターのクリア

i have errors in variation of y for plotting

14 ビュー (過去 30 日間)
Christella Bañaga
Christella Bañaga 2021 年 10 月 27 日
コメント済み: Christella Bañaga 2021 年 10 月 27 日
so heres my code
and the problem i keep getting
  5 件のコメント
DGM
DGM 2021 年 10 月 27 日
The way you're using linspace to define y results in a constant vector. That's going to just give you a straight line.
Why is the assignment saying that y should be 100x100? There's only one independent variable. The output should be a vector. What am I missing?
%Setup the variables I(t) as the function of Current over a period of time t,
%Find also the derivative of I(t) and set as dI
syms I(t);
dI=diff(I,t);
%Initial Conditions
cond1 = I(0) == 2
cond1 = 
L = 0.1 %Inductance
L = 0.1000
R = 50 %Resistance
R = 50
E = 30 %Voltage
E = 30
%Set the differential equation model as eqn1;
eqn1 = L*dI + R*I == E;
subs(eqn1, I(t))
ans(t) = 
%Solve for Isoln as the equation of current at any time t.
Isoln = dsolve(eqn1 , cond1)
Isoln = 
%Set I steady as the current at t approach infinity.
Isteady = limit(Isoln , inf)
Isteady = 
%Set the final time as the 5L/R
tfinal = 5*L/R;
% Plot the equation: Use the Title=Current in RL Circuit, XValue=Time (in Sec), YValue=Current (Amps)
Title = "Current in RL Circuit";
XValue = "Time (in Sec)";
YValue = "Current (Amps)";
%Use the domain (0, tfinal) with 100 points
x = linspace(0,tfinal); % 1x100
y = subs(Isoln,x); % 1x100
plot(x,y);
hold on;
grid on;
title(Title)
xlabel(XValue),ylabel(YValue);
Christella Bañaga
Christella Bañaga 2021 年 10 月 27 日
THANK YOU SO MUCHHHH

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by