Fixing matrix dimensions to match
Afficher commentaires plus anciens
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);
Réponse acceptée
Plus de réponses (1)
Jan
le 29 Jan 2018
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.
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!