sfun_vargain.m in SIMULINK.rar


simulink some application examples and related exercises are with the reference...Original Link
    Sponsored links

			
function [sys,x0,str,ts] = sfun_vargain(t,x,u,flag,gain)

%multiplies the input signal by a variable gain.

switch flag,

  case 0,
    [sys,x0,str,ts]=mdlInitializeSizes;

  case 1,
    sys=mdlDerivatives(t,x,u);

  case 2,
    sys=mdlUpdate(t,x,u);

  case 3,
    sys=mdlOutputs(t,x,u,gain);

  case 4,
    sys=mdlGetTimeOfNextVarHit(t,x,u);

  case 9,
    sys=mdlTerminate(t,x,u);

  otherwise
    error(['Unhandled flag = ',num2str(flag)]);

end

function [sys,x0,str,ts]=mdlInitializeSizes(initial_state)

sizes = simsizes;

sizes.NumContStates  = 0;
sizes.NumDiscStates  = 0;
sizes.NumOutputs     = 1;
sizes.NumInputs      = 1;
sizes.DirFeedthrough = 1;
sizes.NumSampleTimes = 1;   % at least one sample time is needed

sys = simsizes(sizes);

%
% initialize the initial conditions
%
x0  = [];

%
% str is always an empty matrix
%
str = [];

%
% initialize the array of sample times
%
ts  = [0 0];

% end mdlInitializeSizes

%
%=============================================================================
% mdlDerivatives
% Return the derivatives for the continuous states.
%=============================================================================
%
function sys=mdlDerivatives(t,x,u)

sys = [];

% end mdlDerivatives

%
%=============================================================================
% mdlUpdate
% Handle discr			

			...
			...
			... to be continued.

  This is a preview. To get the complete source file, 
  please click here to download the whole source code package.

			
			


Project Files

    Sponsored links
NameSizeDate
 acoustics.mdl7.22 kB10-03-01 12:39
 advancedintegrator.mdl8.13 kB10-03-01 12:39
 ALGLOOP1.MDL6.63 kB10-03-01 12:39
 ALGLOOP2.MDL7.63 kB10-03-01 12:39
 ALGLOOP3.MDL10.71 kB10-03-01 12:40
 AMTRIG.MDL10.80 kB10-03-01 12:40
 AM_PARAM.MDL7.56 kB10-03-01 12:40
 AUDIO.WAV48.04 kB10-03-01 12:40
 breakalgloop.mdl10.74 kB10-03-01 12:40
 BUNGEE.MDL13.27 kB10-03-01 12:40
 bungeescript.m120.00 B10-03-01 12:40
 bungee_cb.mdl12.82 kB10-03-01 12:40
 bungee_cmd.mdl13.63 kB10-03-01 12:40
 comm_system.mdl7.82 kB10-03-01 12:40
 configurelib.mdl10.97 kB10-03-01 12:40
 controlmask.mdl10.33 kB10-03-01 12:41
 control_mask.mdl12.80 kB10-03-01 12:41
 correlation.mdl7.21 kB10-03-01 12:41
 create_signal.m96.00 B10-03-01 12:41
 cruisesystem2.mdl12.81 kB10-03-01 12:41
 ENABLED.MDL19.46 kB10-03-01 12:41
 enablesub.mdl19.47 kB10-03-01 12:41
 floating_displays.mdl7.67 kB10-03-01 12:41
 frameprocessing.mdl9.88 kB10-03-01 12:41
 frame_sinks.mdl7.35 kB10-03-01 12:41
 freq_response.mdl8.97 kB10-03-01 12:42
 FUN_MFUN.MDL6.59 kB10-03-01 12:42
 hybridmodel.mdl8.15 kB10-03-01 12:42
 hybridmodel_script.m213.00 B10-03-01 12:42
 HYDRO.BMP110.41 kB10-03-01 12:42
 HYDRO1.MDL9.40 kB10-03-01 12:42
 HYDRO2.MDL10.07 kB10-03-01 12:42
 HYDRO2B.MDL10.88 kB10-03-01 12:42
 HYDRO3.M167.00 B10-03-01 12:42
 HYDRO4.MDL11.11 kB10-03-01 12:42
 HYDRO5.MAT13.94 kB10-03-01 12:42
 HYDRO5.MDL10.85 kB10-03-01 12:43
 hydro5_final.mat3.80 kB10-03-01 12:43
 hydro5_init.mat3.77 kB10-03-01 12:43
 iconproperties.mdl12.08 kB10-03-01 12:43
 IN_OUT.MDL5.99 kB10-03-01 12:43
 IOSCRIPT.M91.00 B10-03-01 12:43
 matrix_gain.mdl5.87 kB10-03-01 12:43
 matrix_signals.mdl7.91 kB10-03-01 12:43
 MYSYS.MDL8.26 kB10-03-01 12:43
 population.mdl9.09 kB10-03-01 12:43
 populationlib.mdl7.96 kB10-03-01 12:44
 population_grouped.mdl9.42 kB10-03-01 12:43
 population_masked.mdl10.10 kB10-03-01 12:43
 powerspect.mdl8.22 kB10-03-01 12:44
 repeat_me.mdl8.03 kB10-03-01 12:44
 sfun_delay8.12 kB10-03-01 12:44
 sfun_delay.m2.46 kB10-03-01 12:44
 SFUN_INT.M2.79 kB10-03-01 12:44
 sfun_population.m2.82 kB10-03-01 12:44
 sfun_times2.m2.71 kB10-03-01 12:44
 sfun_vargain.m2.75 kB10-03-01 12:44
 SIMPLE.MDL8.39 kB10-03-01 12:44
 <simulink-blank.html>0.00 B10-03-01 12:44
 simulink-blank.sgml2.88 kB10-03-01 12:45
 <simulink-dynamic.html>0.00 B10-03-01 12:45
 simulink-dynamic.sgml3.80 kB10-03-01 12:45
 S_INT.MDL6.44 kB10-03-01 12:44
 s_population.mdl6.05 kB10-03-01 12:44
 s_vargain.mdl6.46 kB10-03-01 12:44
 TIMES2.M8.12 kB10-03-01 12:45
 triggeredsub.mdl18.88 kB10-03-01 12:45
 VECTORS.MDL10.28 kB10-03-01 12:45
 vector_gain.mdl5.81 kB10-03-01 12:45
 <where>0.00 B47 47
 zerocrossingdetection.mdl7.93 kB10-03-01 12:45
 ZEROXING.MDL9.24 kB10-03-01 12:45
 zohtrigger.mdl12.72 kB10-03-01 12:45
 AMDEM.MDL7.25 kB10-03-01 12:46
 AMLIB.MDL10.43 kB10-03-01 12:46
 AMMASK.MDL8.58 kB10-03-01 12:46
 AMMOD.MDL6.26 kB10-03-01 12:46
 AMTRANS.MDL7.50 kB10-03-01 12:46
 basics_exercise.mdl9.67 kB10-03-01 12:46
 bungee_tmpl.m3.03 kB10-03-01 12:46
 commsconfig.mdl8.72 kB10-03-01 12:46
 commscript.m153.00 B10-03-01 12:46
 comms_command.mdl7.95 kB10-03-01 12:46
 CONTSYS.MDL8.33 kB10-03-01 12:46
 cruiseconfig.mdl8.95 kB10-03-01 12:47
 cruisecontrol.mdl10.78 kB10-03-01 12:47
 cruiselib.mdl17.16 kB10-03-01 12:47
 cruisescript.m111.00 B10-03-01 12:47
 cruisesystem.mdl7.64 kB10-03-01 12:47
 cruise_command.mdl14.21 kB10-03-01 12:46
 cruise_mask.mdl13.91 kB10-03-01 12:47
 F2C.M75.00 B10-03-01 12:47
 f2cscript.m126.00 B10-03-01 12:47
 filter_exercise.mdl10.32 kB10-03-01 12:47
 sfun_bungee.m3.03 kB10-03-01 12:47
 signallib.mdl9.66 kB10-03-01 12:47
 simclasslib.mdl13.40 kB10-03-01 12:48
 simplecomms.mdl7.59 kB10-03-01 12:48
 simplesys.mdl6.91 kB10-03-01 12:48
 squared_sine.mdl9.43 kB10-03-01 12:48
 S_BUNGEE.MDL6.14 kB10-03-01 12:47
 <Examples>0.00 B31-07-08 20:35
 <Exercises>0.00 B31-07-08 20:33
 <SIMULINK>0.00 B31-07-08 20:33
...

Related Items

    Sponsored links