how to call the function and where i should call command window?? or within the niew script(in my code)
    조회 수: 3 (최근 30일)
  
       이전 댓글 표시
    
function [rho,temp,press]=atmos(h_in,toffset)
if nargin<2
    toffset=0;
end
if nargin<1
    h_in =0;
end
dimVarout=false;
if isa(h_in,'DimVar')
    h_in=h_in/u.m;
    dimVarout=true;
end
if isa(toffset,'dimVa')
    toffset=toffset/u.k;
end
TonTi=1-2.255769564462953e-005*h_in;
press=101325*TonTi.^5.255879734954165;
temp=TonTi*288.15+toffset;
rho=press./temp/287.05287424707439;
if dimVarout
    rho=rho*u.kg/(u.m^3);
    temp=temp*u.k;
    press=press*u.pa;
end
% this is the function i need the value of rho form that so i can use rho for my further code
% this is my further ...how should i assign or call it in my further code
clc
clear
sigma=0.047193;
    V_tip=180;
    W=180;
    Cd_avg=0.01;
    R=2.235;
    k=1.1;
    A=pi*R.^2;
P_e= 61147.4;
P_req=k*((W)^(3/2))./sqrt(2.*rho.*A)+(Cd_avg*rho*sigma*A.*(V_tip).^3)./(8) +747.643-(0.3*P_e);
V_c=(P_e-P_req)./W;
댓글 수: 0
채택된 답변
  Star Strider
      
      
 2021년 3월 7일
        If you want to use the results in your script, call it from the script.  The results will appear in your workspace.  
Note that to get all the outputs, you will need to call it as: 
[rho,temp,press]=atmos(h_in,toffset)'
With the input arguments already being present in your calling script workspace.  
댓글 수: 0
추가 답변 (1개)
  Image Analyst
      
      
 2021년 3월 7일
        Call it from within your script and pass in the values.  For example, this might be your script (m-file):
h_in = 5; % Whatever
toffset = 15; % whatever
[rho, temp, press] = atmos(h_in, toffset)
댓글 수: 0
참고 항목
카테고리
				Help Center 및 File Exchange에서 Whos에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


