Error using (function_name). Too many output arguments.
I’m having some issues with this code:
clear
clc
fluido = "aria"
i=0;
for temp = 15:0.1:1500
i=i+1;
temperatura(i)=temp;
vettore_cp(i)=calcolo_cp(temp, fluido);
end
plot(temperatura,vettore_cp,"b-")
title("grafico del calore specifico in funzione della temperatura")
xlabel("temperatura [°C]")
ylabel("calore specifico [J/kg*K]")
The program should plot a diagram using the function calcolo_cp that calculates the specific heat and uses as inputs the temperature of the fluid and what type of fluid we want to examinate ( in this case "aria", "air" in english).
The function calcolo_cp is in the same folder and seems to work fine, the code of this function is:
function calcolo_cp(T,fluido)
if strcmp(fluido, "aria")
indice_riga=1;
elseif strcmp(fluido, "gas")
indice_riga=2;
else
disp("ERRORE FLUIDO")
end
coeff=[1000.61 0.482759e-1 0.462906e-3 -0.454035e-6 0.129112e-9;
1013.71 0.641882e-1 0.452287e-3 -0.444350e-6 0.125765e-9];
for i = 1:5
elementi_cp(i) = coeff(indice_riga,i)*T^(i-1);
end
cp = sum(elementi_cp)
end
I’m here if you need more information about my code.
Thank you all.I’m having some issues with this code:
clear
clc
fluido = "aria"
i=0;
for temp = 15:0.1:1500
i=i+1;
temperatura(i)=temp;
vettore_cp(i)=calcolo_cp(temp, fluido);
end
plot(temperatura,vettore_cp,"b-")
title("grafico del calore specifico in funzione della temperatura")
xlabel("temperatura [°C]")
ylabel("calore specifico [J/kg*K]")
The program should plot a diagram using the function calcolo_cp that calculates the specific heat and uses as inputs the temperature of the fluid and what type of fluid we want to examinate ( in this case "aria", "air" in english).
The function calcolo_cp is in the same folder and seems to work fine, the code of this function is:
function calcolo_cp(T,fluido)
if strcmp(fluido, "aria")
indice_riga=1;
elseif strcmp(fluido, "gas")
indice_riga=2;
else
disp("ERRORE FLUIDO")
end
coeff=[1000.61 0.482759e-1 0.462906e-3 -0.454035e-6 0.129112e-9;
1013.71 0.641882e-1 0.452287e-3 -0.444350e-6 0.125765e-9];
for i = 1:5
elementi_cp(i) = coeff(indice_riga,i)*T^(i-1);
end
cp = sum(elementi_cp)
end
I’m here if you need more information about my code.
Thank you all. I’m having some issues with this code:
clear
clc
fluido = "aria"
i=0;
for temp = 15:0.1:1500
i=i+1;
temperatura(i)=temp;
vettore_cp(i)=calcolo_cp(temp, fluido);
end
plot(temperatura,vettore_cp,"b-")
title("grafico del calore specifico in funzione della temperatura")
xlabel("temperatura [°C]")
ylabel("calore specifico [J/kg*K]")
The program should plot a diagram using the function calcolo_cp that calculates the specific heat and uses as inputs the temperature of the fluid and what type of fluid we want to examinate ( in this case "aria", "air" in english).
The function calcolo_cp is in the same folder and seems to work fine, the code of this function is:
function calcolo_cp(T,fluido)
if strcmp(fluido, "aria")
indice_riga=1;
elseif strcmp(fluido, "gas")
indice_riga=2;
else
disp("ERRORE FLUIDO")
end
coeff=[1000.61 0.482759e-1 0.462906e-3 -0.454035e-6 0.129112e-9;
1013.71 0.641882e-1 0.452287e-3 -0.444350e-6 0.125765e-9];
for i = 1:5
elementi_cp(i) = coeff(indice_riga,i)*T^(i-1);
end
cp = sum(elementi_cp)
end
I’m here if you need more information about my code.
Thank you all. error function, plot, too many output arguments, too many inputs arguments MATLAB Answers — New Questions