Trying to input multiple vectors into function

조회 수: 2 (최근 30일)
Dean H Hu
Dean H Hu 2020년 10월 23일
편집: madhan ravi 2020년 10월 23일
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."

채택된 답변

madhan ravi
madhan ravi 2020년 10월 23일
편집: madhan ravi 2020년 10월 23일
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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by