22.06.2015 Views

CIFER®-MATLAB Interfaces: Development and ... - Cal Poly

CIFER®-MATLAB Interfaces: Development and ... - Cal Poly

CIFER®-MATLAB Interfaces: Development and ... - Cal Poly

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Appendix H: Mass-Spring-Damper Case Example<br />

This example is for a simple second order mass-spring-damper system modeled in Simulink as a<br />

transfer function. A frequency sweep simulating noise was run through the model <strong>and</strong> the input<br />

<strong>and</strong> output data recorded into a time history file. One case was set up entirely in CIFER <strong>and</strong> then<br />

a second was set up <strong>and</strong> run from <strong>MATLAB</strong>. The comm<strong>and</strong>s shown below were used to run the<br />

case from <strong>MATLAB</strong>. <strong>Cal</strong>ls to the CIFER-<strong>MATLAB</strong> interface functions have been highlighted in<br />

red. This example is provided to give a very simple scenario to set up cases using the <strong>MATLAB</strong><br />

interface. CIFER does not come with this example so the simulation would have to be created <strong>and</strong><br />

run in order to generate the data necessary.<br />

% Assign a blank frespid structure<br />

f_in = frespid;<br />

thename = 'MASSSPRG';<br />

% Fill in all the necessary information to make the case<br />

f_in.casename<br />

= thename;<br />

f_in.comments<br />

f_in.caseout<br />

= 'mass spring system';<br />

= thename;<br />

f_in.crosscor<br />

= 'Y';<br />

% Time history selection parameters:<br />

f_in.source = 5;<br />

f_in.evntnum(1) = 1;<br />

f_in.flghtnum(1)<br />

f_in.thdt<br />

= 1;<br />

= 0.01;<br />

f_in.thfile(1)<br />

= {'massspring.CIFERTEXT'};<br />

% channel definition parameters:<br />

f_in.controls(1)<br />

= {'IN'};<br />

f_in.outputs(1)<br />

= {'OUT'};<br />

f_in.conchnl(1,1)<br />

f_in.outchnl(1,1)<br />

= {'IN'};<br />

= {'OUT'};<br />

% Frequency response selection parameters<br />

f_in.frcalc(1,1) = {'*'};<br />

% NOTE: The file 'massspring.CIFERTEXT' was created for this example,<br />

% in order to run the example this file must be created.<br />

% Save the structure into the database<br />

frespid(f_in,2);<br />

% Change the window sizes <strong>and</strong> turn them on.<br />

frespid('MASSSPRG',2,'winlen',[30,25,20,15,10],'winon',{'*','*','*','*',<br />

'*'},<br />

'maxfft',[125,125,125,125,125]);<br />

% Set up blank composite case<br />

c_in = composite;<br />

% Fill in appropriate values<br />

c_in.casename<br />

= thename;<br />

c_in.comments<br />

c_in.casein<br />

= 'mass spring system';<br />

= thename;<br />

c_in.caseout<br />

= thename;<br />

c_in.inpgm<br />

c_in.controls(1)<br />

= 'FRE';<br />

= {'IN'};<br />

100

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!