why i got error on this coding for graphical method?

1 Ansicht (letzte 30 Tage)
Muhamad Fadhil
Muhamad Fadhil am 2 Mai 2020
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

Antworten (1)

KALYAN ACHARJYA
KALYAN ACHARJYA am 2 Mai 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 Kommentare
Muhamad Fadhil
Muhamad Fadhil am 2 Mai 2020
what's the difference?
Walter Roberson
Walter Roberson am 3 Mai 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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by