MATLAB Answers

how to solve 'Error using | Matrix dimensions must agree. ' ?

조회 수: 3(최근 30일)
Igor Collins
Igor Collins 19 Nov 2019
Answered: Bhaskar R 19 Nov 2019
how to solve 'Error using | MatrixMatrix, dimensions must agree. ' ? here is my code
clc; clear all;
T=0:0.001:0.07;
size(T);
cm=1.;
lo=-3.545-0.833*log(100*cm)-(9601.-2368.*log(100.*cm))/(T-195.7-32.25*log(100.*cm))
figure();
plot(T, lo, 'DisplayName','T=700000')

  댓글 수: 0

로그인 to comment.

답변 수 (2)

KSSV
KSSV 19 Nov 2019
KSSV 님이 편집함. 19 Nov 2019
clc; clear all;
T=0:0.001:0.07;
size(T);
cm=1.;
lo=-3.545-0.833*log(100*cm)-(9601.-2368.*log(100.*cm))./(T-195.7-32.25*log(100.*cm))
figure();
plot(T, lo, 'DisplayName','T=700000')
Read about MATLAB element by element operations. You are dividing two arrays, you need to divide element by element.

  댓글 수: 0

로그인 to comment.


Bhaskar R
Bhaskar R 19 Nov 2019
You have used mrdivide not normal division here.
correct one is
clc; clear all;
T=0:0.001:0.07;
size(T);
cm=1.;
lo=-3.545-0.833*log(100*cm)-(9601.-2368.*log(100.*cm))./(T-195.7-32.25*log(100.*cm)); % division by element
figure();
plot(T, lo, 'DisplayName','T=700000')

  댓글 수: 0

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.

제품


Translated by