필터 지우기
필터 지우기

??? Error using ==> mpower Matrix must be square.

조회 수: 8 (최근 30일)
Mariela Flores
Mariela Flores 2017년 10월 7일
답변: aref mero 2017년 10월 8일
hello everybody, I'm triying to create a graphic, but when I run the program, it gives me an error:
??? Error using ==> mpower Matrix must be square. Error in ==> ssssssssss at 5 y=1/sqrt((1-(x^2))^2+(2*xi*x)^2);
this is my code:
% code
clc;
xi=0;
x=0:0.01:5;
y=1/sqrt((1-(x^2))^2+(2*xi*x)^2);
plot(x,y)
Instead of using plot, I've tried SEMILOGY and LOGLOG but the message is the same.

채택된 답변

James Tursa
James Tursa 2017년 10월 7일
You need to use the element-wise operators that have a dot in front of them instead of the matrix operators. So use this instead:
y = 1 ./ sqrt((1-(x.^2)).^2 + (2*xi*x).^2);
  댓글 수: 1
Mariela Flores
Mariela Flores 2017년 10월 7일
Oh! you are right! THANK YOU SO MUCH!!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

aref mero
aref mero 2017년 10월 8일
for SP=1:20 E1=Q*F1; bug=bug+E1; % bug=bug+E1 end bug=0; for SP=1:20 E2=Q*F2; bug=bug+E2; % bug=bug+E2 end E=sqrt(E1^2+E2^2)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by