why i got error on this coding for graphical method?

clc
clear all
close all
T=0:200:1400;
f=(0.99403)+((1.671*10^-4)*(T))+((9.7215*10^-8)*(T^2))-((9.5838*10^-11)*(T^3))+((1.9520*10^-14)*(T^4))-(1.2);
plot(f,T)
grid on
the interval is 200-1400, i want to get the graph as above which i got from excel

답변 (1개)

KALYAN ACHARJYA
KALYAN ACHARJYA 2020년 5월 2일
T=0:200:1400;
f=(0.99403)+((1.671*10^-4)*(T))+((9.7215*10^-8)*(T.^2))-((9.5838*10^-11)*(T.^3))+((1.9520*10^-14)*(T.^4))-(1.2);
plot(f,T)
grid on

댓글 수: 2

what's the difference?
T^2 compared to T.^2 .
The ^ operator corresponds to repeated use of the * operator, with the * operator being algebraic matrix multiplication. You can only use the ^ operator when you are working with square matrices, not with vectors:
T^2 with T being (1 x N) is (1 x N) * (1 x N) is error because the size of the second dimension of the first value, N, is not the same as the size of the first dimension of the second value, 1.
The .^ operator is element-by-element exponentiation, corresponding to repeated use of the .* operator. T.^2 is (1xN) .* (1.N) which is fine because the sizes match.

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

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

질문:

2020년 5월 2일

댓글:

2020년 5월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by