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

Respuestas (1)

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 comentarios

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.

Iniciar sesión para comentar.

Categorías

Etiquetas

Preguntada:

el 2 de Mayo de 2020

Comentada:

el 3 de Mayo de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by