Trying to input multiple vectors into function

2 visualizaciones (últimos 30 días)
Dean H Hu
Dean H Hu el 23 de Oct. de 2020
Editada: madhan ravi el 23 de Oct. de 2020
Hello,
I am trying to feed 2 same length vectors into the function I have made below, I want it to return an output vector of the same length
function stagpres1 = stagpres(deltaP, flowarea)
gmpercm2 = deltaP * 0.010197; %convert delta P from Pa to g/cm^2
v2 = gmpercm2/(flowarea / 317.75); %obtain velocity^2 from equation
Velocity = sqrt(v2);
stagpres1 = (1/2) * 1 * (Velocity.^2);
end
However, when I try to run it, it returns the error "not enough input arguments."

Respuesta aceptada

madhan ravi
madhan ravi el 23 de Oct. de 2020
Editada: madhan ravi el 23 de Oct. de 2020
stagpres1 = stagpres(1:10, 1:10)
function stagpres1 = stagpres(deltaP, flowarea)
gmpercm2 = deltaP * 0.010197; %convert delta P from Pa to g/cm^2
v2 = gmpercm2 ./ (flowarea / 317.75); %obtain velocity^2 from equation
Velocity = sqrt(v2);
stagpres1 = (1/2) * 1 * (Velocity.^2);
end

Más respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by