why i got error on this coding for graphical method?

1 view (last 30 days)
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

Answers (1)

KALYAN ACHARJYA
KALYAN ACHARJYA on 2 May 2020
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 Comments
Walter Roberson
Walter Roberson on 3 May 2020
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.

Sign in to comment.

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!