Fixing matrix dimensions to match
이전 댓글 표시
I'm attempting to plot Pone and Ptwo(P standing for Power), vs. the AngleDif between the two sources. The program doesn't like that my matrix dimensions don't agree on the line Pone = Eone*conj(I). I don't understand how to fix this because the only matrix I'm using is the only to increment the angle theta from -30 to 30. I have very little experience using Matlab if that helps to know. I know that the inner dimensions of two matrices must match to multiply, but I'm having trouble visualizing the process here.
t = 1;
theta = (-30:5:30);
w = 120 * pi;
Eone = (100/sqrt(2))*cosd(theta)+(100/sqrt(2))*1i*sind(theta);
Etwo = (100/sqrt(2))*cosd(30)+(100/sqrt(2))*1i*sind(30);
z = 2 + 1i*5;
I = (Eone - Etwo)/(z);
Pone = Eone*conj(I);
Ptwo = Etwo*conj(I);
Ploss = I*z*z;
AngleDif = 30 - theta;
plot(Pone, Ploss, AngleDif);
채택된 답변
추가 답변 (1개)
Jan
2018년 1월 29일
The computations work, when you apply the elementwise multiplication with the .* operator instead of the matrix multiplication *
Pone = Eone .* conj(I);
Ptwo = Etwo .* conj(I);
But then the plotting fails:
Error using plot
Data must be a single matrix Y or a list of pairs X,Y.
Maybe you want:
plot3(Pone, Ploss, AngleDif);
but this ignores the imaginary part and show a corresponding warning also.
카테고리
도움말 센터 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!