clear all;
clc
Vm=100;
Z=2;
angle_radians=pi*-0.5;
wt=0:0.01:(2*pi);
v=Vm*cos(wt);
Im=Vm/Z;
i=Im*cos((wt)-(angle_radians));
p=(v.*i);
pr=v*i*cos(angle_radians)*(1+cos(2*wt));
px=v*i*sin(angle_radians)*(1+sin(2*wt));
subplot(4,1,1);plot(wt,v,wt,i);title('v(t)=Vmcoswt,I(t)=Imcos(wt+-(-90)');
xlabel('time');
ylabel('voltage (volts) & Current (Amps)');
subplot(4,1,2);plot(wt,p);title('p(t)=v(t)i(t)');
xlabel('time (t)');
ylabel('power (Watts)');
subplot(4,1,3);plot(wt,pr);title('pr(t)');
xlabel('time (t)');
ylabel('pr(t)');
subplot(4,1,4);plot(t,i);title('px(t)');
xlabel('time (t)');
ylabel('px(t))');
grid;
2 Comments
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/705878-what-is-wrong-with-my-matlab-codes-matlab-please-help-me#comment_1236763
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/705878-what-is-wrong-with-my-matlab-codes-matlab-please-help-me#comment_1236763
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/705878-what-is-wrong-with-my-matlab-codes-matlab-please-help-me#comment_1236778
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/705878-what-is-wrong-with-my-matlab-codes-matlab-please-help-me#comment_1236778
Sign in to comment.