MATLAB Answers

Trying to input multiple vectors into function

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

  댓글 수: 0

댓글을 달려면 로그인하십시오.

채택된 답변

madhan ravi
madhan ravi 23 Oct 2020
편집: madhan ravi 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

  댓글 수: 0

댓글을 달려면 로그인하십시오.

추가 답변(0개)

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by