MATLAB Answers

Matrix dimensions must agree error

1 view (last 30 days)
Ali Roshanzamir
Ali Roshanzamir on 30 Jul 2020
Commented: Ali Roshanzamir on 30 Jul 2020
Hey guys.
I wanted to plot a square wave, but i got this error. can you please help me.
Ws=2*pi*60;
tetha=0;
t=0:0.0001:0.1;
v1=1:1:inf; % it can be v1=1:1:30
N=45;
I=10;
p=2;
K =(2*N*I)/(pi*p);
F1=(K.*0.95).*((1/2).*(cos(Ws.*t-tetha)+cos(Ws.*t+tetha))-cos(Ws.*t).*cos(v1.*tetha).*cos(v1.*120)+sqrt(3).*(sin(Ws.*t).*sin(v1.*tetha).*sin(v1.*120)));
subplot(2,1,1)
plot(F)

  0 Comments

Sign in to comment.

Accepted Answer

KSSV
KSSV on 30 Jul 2020
Ws=2*pi*60;
tetha=0;
t=0:0.0001:0.1;
v1=linspace(1,30,length(t)); % it can be v1=1:1:30
N=45;
I=10;
p=2;
K =(2*N*I)/(pi*p);
F1=(K.*0.95).*((1/2).*(cos(Ws.*t-tetha)+cos(Ws.*t+tetha))-cos(Ws.*t).*cos(v1.*tetha).*cos(v1.*120)+sqrt(3).*(sin(Ws.*t).*sin(v1.*tetha).*sin(v1.*120)));
subplot(2,1,1)
plot(t,F1)

  1 Comment

Ali Roshanzamir
Ali Roshanzamir on 30 Jul 2020
Thank you very much for you fast reply.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!