Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %{
- SS Lab Class 7
- Rahat Sir
- Date: 06-11-2019
- %}
- % Solution of Differential Equation
- %f = 'Dy + y - cos(t)';
- %y = dsolve(f,'y(0)=2');
- %ezplot(y,[1 20])
- %f ='2*D2y+Dy+y-D(cos(t))';
- % Evaluate difference Equation
- b = [.067 .1349 .675];
- a =[1 -1.143 .4128];
- n = 1:20;
- x = (.5).^n;
- zi = filtic(b,a,[1 2]);
- y = filter(b,a,x,zi);
- stem
- %% Fourier Series
- T0 = 1; E =1; w0 = 2*pi; a0 =E/2;
- n = 20;
- f = a0/2;
- t = -1.5:.01:1.5;
- for N=1:n
- an = ((2*E)/(N*w0*T0))*(sin(N*pi/2)-sin(3*N*pi/2));
- f = f+ an .* cos(N*w0*t);
- end
- plot(t,f)
- %f = a0/2 + sum(an*cos nwt)
- %% another fourier Series
- T0 = 2*pi; w0=1; a0=1/2; E = 1;
- n =20;
- f = a0/2;
- t = -1.5:.01:1.5;
- for N=1:n
- bn = -1/(n.*pi);
- f = f+ bn.*cos(N*wo*t);
- end
- plot(t,f)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement