Here is what i did now want to make up matlbcoode
What are your thoughts?
Please share your work with us ...even if you know it is wrong.
If you are stuck at the beginning tell us and we'll start with the definitions.
You need to read the rules of this forum. Please read the post titled
"Read before Posting" at the following URL:
http://www.freemathhelp.com/forum/announcement.php?f=33
(a)
L dI/dt + RI(t) = 5cos(ωt)
Divide the equation by L to produce
dI/dt – R/L*I = V/L. cos ωt
Assume that: a = -R/L and X = V/L
dI/dt – a*I = X* cos ωt
(b)
The complex impedance Z = R + iωL replaces R when L =/ 0 and I(t) = Ieiωt.
LDI/dt +RI(t) = (iωL+R) Ie^iωt = 5e^iωt
|Z| = √((R^2+ω^2 L^2)) and tan θ = ωL/R
............................................
it will be appreciated if you please check if this code is appropriate for the above question
CODE: by dsolve
solution = dsolve('DI=(5/L)*cos(w*t)- R*(I/L)')
% self assuming the values of resistance inductance and w to plot the data
V=5;
R=250;
L= 10
w=2*pi*50;
s = dsolve('DI=(5/10)*cos(2*pi*50*t)- 250*(I/10)')
ezplot(s,[0 100]); hold on;
xlabel('t (time)','FontSize',14); ylabel('I (ampare)','FontSize',14);
axis([0 5 0 100]); set(gcf,'color','w'); drawnow
Z = sqrt((R^2+w^2*L^2))
theta = atan(w*L/R)
CODE: by ode45
function ode_Q1
tini=0; tend = 8; tspan=tini:0.001:tend;
i0=[1];
opt = odeset('AbsTol',1e-8);
[t, i]=ode45(@fun,tspan,i0,opt);
figure('color','w');
plot(t,i,'LineWidth',1.5); hold on
xlabel('time, t','FontSize',14);
ylabel('I','FontSize',14);
figure('color','w');
end
function di = fun(t,i)
V=5;
R=250;
L=20;
w=2*pi*60;
di = zeros(length(i),1);
di = (V/L)*cos(w*t)-(R/L)*i;
end
waiting for kind response ...