Trying to input multiple vectors into function

3 vues (au cours des 30 derniers jours)
Dean H Hu
Dean H Hu le 23 Oct 2020
Modifié(e) : madhan ravi le 23 Oct 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."

Réponse acceptée

madhan ravi
madhan ravi le 23 Oct 2020
Modifié(e) : madhan ravi le 23 Oct 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

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by