Contents     Functions         Previous Next     PDF Index



Generic handling of curves and signal processing utilities




fe_curve is used to handle curves and do some basic signal processing. The format for curves is described in section 7.9. The iiplot interface may be used to plot curves and a basic call would be iiplot(Curve) to plot curve data structure Curve.

Accepted commands are

bandpass Unit f_min f_max

out=fe_curve('BandPass Unit f_min f_max',signals);
realizes a true bandpass filtering (i.e. using fft() and ifft()) of time signals contained in curves signals. f_min and f_max are given in units Unit, whether Hertz(Hz) or Radian(Rd). With no Unit, f_min and f_max are assumed to be in Hertz.

out=fe_curve('TestFrame');% 3 DOF oscillator response to noisy input
fe_curve('Plot',out{2});  % "unfiltered" response
filt_disp=fe_curve('BandPass Hz 70 90',out{2}); % filtering 
fe_curve('Plot',filt_disp); title('filtered displacement');

datatype [,cell]

returns a data structure describing the data type, useful to fill .xunit and .yunit fields for curves definition. DesiredType could be a string or a number corresponding to the desired type. With no DesiredType, the current list of available types is displayed. One can specify the unit with out=fe_curve('DataType',DesiredType,'unit');.

DataTypeCell returns a cell array rather than data structure to follow the specification for curve data structures.


extracts curve curve_name from model.Stack or the possible curves attached to a load case. If the user does not specify any name, all the curves are returned in a cell array.

h1h2 input_channels

FRF=fe_curve('H1H2 input_channels',frames,'window');
computes H1 and H2 FRF estimators along with the coherence from time signals contained in cell array frames using window window. The time vector is given in frames1.X while input_channels tells which columns of in frames1.Y are inputs. If more than one input channel is specified, true MIMO FRF estimation is done, and Hν is used instead of H2. When multiple frames are given, a mean estimation of FRF is computed.

Note: To ensure the proper assembly of H1 and Hν in MIMO FRF estimation case, a weighing based on maximum time signals amplitude is used. To use your own, use
FRF=fe_curve('H1H2 input_channels',frames,window,weighing);
where weighing is a vector containing weighing factors for each channel. To avoid weighing, use
FRF=fe_curve('H1H2 input_channels',frames,window,0);


OBSOLETE : use fe_curve TestNoise instead

computes a Nw_pt points long time signal corresponding to a “white noise”, with sample frequency fs and a unitary power spectrum density until f_max. fs/2 is taken as f_max when not specified. The general shape of noise power spectrum density, extending from 0 to fs/2, can be specified instead of f_max.

% computes a 2 seconds long white noise, 1024 Hz of sampling freq.
% with "rounded" shape PSD    
fs=1024; sample_length=2;
Shape=exp(fe_curve('window 1024 hanning'))-1; 
subplot(211);fe_curve('plot -gca',noise_h);axis tight;
subplot(212);fe_curve('plot -gca',noise_f);axis tight;


fe_curve('plot',curve); plots the curve curve.
fe_curve('plot',fig_handle,curve); plots curve in the figure with handle fig_handle.
fe_curve('plot',model,'curve_name'); plots the curve of model.Stack named curve_name.
fe_curve('plot',fig_handle,model,curve_name); plots curve named curve_name stacked in .Stack field of model model.

% computes a 2 seconds long white noise, 1024 Hz of sampling freq.
fs=1024; sample_length=2;
noise.yunit=fe_curve('DataType','Excit. force');'Input force';


resspectrum [True, Pseudo] [Abs., Rel.] [Disp., Vel., Acc.]

computes the response spectrum associated to the time signal given in signal. Time derivatives can be obtained with option -v or -a. Time integration with option +v or +a. Pseudo derivatives with option PseudoA or PseudoV. freq and damp are frequencies (in Hz) and damping ratios vectors of interest for the response spectra. For example

% read the acceleration time signal
bagnol_ns=fe_curve(['read' fullfile(wd,'bagnol_ns.cyt')]);

% read reference spectrum
bagnol_ns_rspec_pa= fe_curve(['read' fullfile(wd,'bagnol_ns_rspec_pa.cyt')]);
% compute response spectrum with reference spectrum frequencies
% vector and 5% damping
RespSpec=fe_curve('ResSpectrum PseudoA',...

fe_curve('plot',RespSpec); hold on;


If curve has a .Interp field, this interpolation is taken in account. If .Interp field is not present or empty, it uses a degree 2 interpolation by default.

To force a specific interpolation (over passing .interp field, one may insert the -linear, -log or -stair option string in the command.

To extract a curve curve_name and return the values Y corresponding to the input X, the syntax is

y = fe_curve('returny',model,curve_name,X);
Given a curve data structure, to return the values Y corresponding to the input X, the syntax is

y = fe_curve('returny',curve,X);


This command sets a curve in the model. 3 types of input are allowed:

When you want to associate a curve to a load for time integration it is preferable to define formally the time dependence (if not curve can be interpolated or extrapolated).

The following example illustrates the different calls.

model=fe_time('demo bar'); q0=[];

% curve defined by a by-hand data structure:
c1=struct('ID',1,'X',linspace(0,1e-3,100), ...
     'xunit',[],'yunit',[],'unit',[],'name','curve 1');
model=fe_curve(model,'set','curve 1',c1);
% curve defined by a string to evaluate (generally test fcn):
model=fe_curve(model,'set','step 1','TestStep 1e-4*10');
% curve defined by a reference curve:
c2=fe_curve('test -ID 100 ricker 10e-4 100 1 100e-4');
c3=fe_curve('test sin 10e-4 100 1 100e-4');

model=fe_curve(model,'set','ricker 1',c2);
model=fe_curve(model,'set','sin 1',c3);

% define Load with curve definition
            'curve',{{fe_curve('test ricker 20e-4 1'),...
                      'ricker 1'}});
model = fe_case(model,'DOFLoad','Point load 1',LoadCase);
% modify a curve in the load case
model=fe_curve(model,'set LoadCurve','Point load 1',2,'TestStep 1e-4*10');

Test ...

The test command handles a large array of analytic and tabular curves. In OpenFEM all parameters of each curve must be given in the proper order. In SDT you can specify only the ones that are not the default using their name.

When the abscissa vector (time, frequency, ...) is given as shown in the example, a tabular result is returned.

Without output argument the curve is simply plotted.

fe_curve('test')  % lists curently implemented curves

t=linspace(0,3,1024); % Define abscissa vector
% OpenFEM format with all parameters
C1=fe_curve('test ramp 0.6 2.5 2.3',t);
C2=fe_curve('TestRicker 2 2',t);

% SDT format non default parameters given with their name
C3=fe_curve('Test CosHan f0=5 A=3');
C4=fe_curve('testEval 3*cos(2*pi*5*t)');

% Now display result
figure(1);plot(t,[C1.Y C2.Y C4.Y C3.Y]);

A partial list of accepted test curves follows


out=fe_curve('TestFrame'); computes the time response of a 3 DOF oscillator to a white noise and fills the cell array out with noise signal in cell 1 and time response in cell 2. Use sdtweb('fe_curve.m#TestFrame') to open the function at this example.


computes response of a system with given transfer functions FRF to time input Input. Sampling frequency and length of time signal Input must be coherent with frequency step and length of given transfer FRF.

fs=1024; sample_length=2;                   % 2 sec. long white noise
noise=fe_curve('noise',fs*sample_length,fs);% 1024 Hz of sampling freq.

% FRF with resonant freq. 50 100 200 Hz, unit amplitude, 2% damping 
xf=nor2xf(2*pi*[50 100 200].',.02,[1 ; 1 ; 1],[1 1 1],2*pi*f);

Resp=fe_curve('TimeFreq',noise,xf); % Response to noisy input
fe_curve('Plot',Resp); title('Time response');

Window ...

Use fe_curve window to list implemented windows. The general calling format is win=fe_curve('Window Nb_pts Type Arg'); which computes a Nb_pts points window. The default is a symmetric window (last point at zero), the command option -per clips the last point of a N+1 long symmetric window.

For the exponential window the arguments are three doubles. win = fe_curve('Window 1024 Exponential 10 20 10'); returns an exponential window with 10 zero points, a 20 point flat top, and a decaying exponential over the 1004 remaining points with a last point at exp(-10).

win = fe_curve('Window 1024 Hanning'); returns a 1024 point long hanning window.

See also

fe_load, fe_case

©1991-2012 by SDTools
Previous Up Next