I have issues calling Simulink in function. the function variable is called in Simulink file in a switch since switch compares a constant value there are errors running.

function Sg = distance(value) %kts
%clc; clear all; close all
%sealevel
vrot = 0;
vrot = value;
Hwind=0.0;
Patm=101325 %Pa
Tatm=273; %K
Sref=11.9 %m2
b=8.85 %m
AR=6.57
mass=1120 %kg
n=1.0
WTO=mass*9.8 %N
CLa=4.4;
CD0=0.065
K100=1/pi/AR;
K0=1/CLa;
bhp=260 %hp
S=0.3; %suction factor
% K=S*K100+(1-S)*K0; %where S is a function of CL
K=0.11
mu =0.03
de=-10/57.3
CLde=0.18
CL0 = 0.5+CLde*de % flaps down0.5, flaps up 0.2
CLmax=CL0+CLa*12/57.3 % alpha max =16 for amber extinction; =12 for illumination of red
CLmin=CLa*4/57.3 % corresponding to alpha min of -4 deg
%vrot=10 %kts
Mach=[0 0.05 0.1 0.2 0.3]
Th0=400
Hm=1000/3.28
[den,a,Tatm,Patm,nu]=stdatmo(Hm,[]);
Th_at=Th0*(den/1.225-(1-den/1.225)/7.55)
Thrust=[1 0.95 0.9 0.85 0.8]*Th_at*9.8 % N

1 commentaire

I do not see a call to Simulink here. Where is the error occurring in your code and what is the error message?

Connectez-vous pour commenter.

Réponses (1)

The function is defined as returning the value of Sg, but Sg is not assigned to in the function.

Catégories

En savoir plus sur Simulink Environment Customization dans Centre d'aide et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by