Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Showing error Matrix dimensions must agree

조회 수: 1 (최근 30일)
Mihir Kaswan
Mihir Kaswan 2019년 9월 21일
마감: MATLAB Answer Bot 2021년 8월 20일
r=[0 : 100 :100];
theta =[0 : 2*pi :100];
z=2*(r-4*sin(theta)./r);
Matrix dimensions must agree.

답변 (2개)

madhan ravi
madhan ravi 2019년 9월 21일
theta =0:2*pi:100;
r=linspace(0,100,numel(theta)); % theta and r should have same length/ or either one be a scalar
z=2*(r-4*sin(theta)./r);
doc linspace
doc numel

the cyclist
the cyclist 2019년 9월 21일
The variable r has just two elements: [0 100].
theta has 16 elements: [0 6.2832 12.5664 18.8496 ...]
What do you expect to happen when you try to divide a vector with 16 elements by one with 2 elements?

Community Treasure Hunt

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

Start Hunting!

Translated by