What is wrong with my matlab codes? ( MATLAB) please help me!

1 回表示 (過去 30 日間)
Santa Fe
Santa Fe 2020 年 12 月 31 日
回答済み: Pemendra Kumar Pardhi 2020 年 12 月 31 日
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;
I am trying to draw graphs about reactive power etc. What can be wrong with line 13 and matrix?
  2 件のコメント
Hyunuk Ha
Hyunuk Ha 2020 年 12 月 31 日
On the 11th, line, you should use .* (array operator) instead of * (matrix operator).
Please refer to detailed Doc. at :
Hope this helps,
Hyunuk
Santa Fe
Santa Fe 2020 年 12 月 31 日
thank you so much!

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

採用された回答

Pemendra Kumar Pardhi
Pemendra Kumar Pardhi 2020 年 12 月 31 日
Please replace the all * with .* for element wise product
and in line no 31, you neet to replace t with wt

その他の回答 (0 件)

コミュニティ

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by