<div class="gmail_quote">On 10 March 2013 09:49, Lester Anderson <span dir="ltr"><<a href="mailto:arctica1963@gmail.com" target="_blank">arctica1963@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="gmail_quote"><div><div class="h5">On 10 March 2013 09:02, TViT <span dir="ltr"><<a href="mailto:tvitklg@rambler.ru" target="_blank">tvitklg@rambler.ru</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hello!<br>
<br>
In Matlab there is a function chirp, and what is in Scilab?<br>
<br>
And why Scilab can not transform a simple example from Matlab of a file?<br>
<br>
//-----------------------------------------------------<br>
t = 0:0.001:2;            % 2 secs @ 1kHz sample rate<br>
y = chirp(t,0,1,150);     % Start @ DC,<br>
                          %   cross 150Hz at t=1 sec<br>
spectrogram(y,256,250,256,1E3,'yaxis')<br>
//-----------------------------------------------------<br>
<br>
 !--error 37<br>
at line     190 of function mfile2sci called by :<br>
at line     142 of function cb_m2sci_gui called by :<br>
cbo = getcallbackobject("-6ebf8d73:13d5388519a:-7f72");cb_m2sci_gui;if<br>
exists("%oldgcbo") then gcbo = %oldgcbo;<br>
while executing a callback<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://mailinglists.scilab.org/Generation-of-linear-frequency-tp4026202.html" target="_blank">http://mailinglists.scilab.org/Generation-of-linear-frequency-tp4026202.html</a><br>
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.<br>
_______________________________________________<br>
users mailing list<br>
<a href="mailto:users@lists.scilab.org" target="_blank">users@lists.scilab.org</a><br>
<a href="http://lists.scilab.org/mailman/listinfo/users" target="_blank">http://lists.scilab.org/mailman/listinfo/users</a><br></blockquote></div></div><div><br>Google the function as chirp.m and you will get the code:<br>
<br><pre><font size="4">function   x = chirp( T, W, p )
%CHIRP    generate a sampled chirp signal
%-----       exp(j(W/T)pi*t^2)   -T/2 <= t < +T/2
%
%   Usage:   X = chirp( T, W, <P> )
%
%      X :  N=pTW samples of a "chirp" signal
%      T :  time duration from -T/2 to +T/2
%      W :  swept bandwidth from -W/2 to +W/2
%
%   optional (default is P = 1)
%      P :  samples at P times the Nyquist rate (W)
%            i.e., sampling interval is 1/(PW)

%---------------------------------------------------------------
% copyright 1994, by C.S. Burrus, J.H. McClellan, A.V. Oppenheim,
% T.W. Parks, R.W. Schafer, & H.W. Schussler.  For use with the book
% "Computer-Based Exercises for Signal Processing Using MATLAB"
% (Prentice-Hall, 1994).
%---------------------------------------------------------------

if nargin < 3
   p = 1;   end    
J = sqrt(-1);
%--------------
delta_t = 1/(p*W);
N = round( p*T*W );    %--- same as T/delta_t
nn = [0:N-1]';
x = exp( J*pi*W/T * (delta_t*nn - T/2).^2 );</font></pre> Just recode in Scilab and place in your main source code or set in a functions libarry to be called.<br>May be different versions of this so best to check around<br>
</div></div></blockquote><div><br>Another more detailed version;<br><font size="4"><br></font><pre><font size="4">function y = chirp(t,f0,t1,f1,method,phi)
%CHIRP  Swept-frequency cosine generator.
%   Y = CHIRP(T,F0,T1,F1) generates samples of a linear swept-frequency
%   signal at the time instances defined in array T.  The instantaneous
%   frequency at time 0 is F0 Hertz.  The instantaneous frequency F1
%   is achieved at time T1.  By default, F0=0, T1=1, and F1=100.
%
%   Y = CHIRP(T,F0,T1,F1,method) specifies alternate sweep methods.
%   Available methods are 'linear','quadratic', and 'logarithmic'; the
%   default is 'linear'.  Note that for a log-sweep, F1>F0 is required.
%
%   Y = CHIRP(T,F0,T1,F1,method, PHI) allows an initial phase PHI to
%   be specified in degrees.  By default, PHI=0.
%
%   Y = CHIRP(T,P) specifies a polynomial vector P for the
%   instantaneous frequency trajectory of the chirp.  P may not be
%   a scalar value.
%
%   Default values are substituted for empty or omitted trailing input
%   arguments.
%
%   EXAMPLE 1: Compute the spectrogram of a linear chirp.
%     t=0:0.001:2;                 % 2 secs @ 1kHz sample rate
%     y=chirp(t,0,1,150);          % Start @ DC, cross 150Hz at t=1sec 
%     specgram(y,256,1E3,256,250); % Display the spectrogram
%
%   EXAMPLE 2: Compute the spectrogram of a quadratic chirp.
%     t=-2:0.001:2;                % +/-2 secs @ 1kHz sample rate
%     y=chirp(t,100,1,200,'q');    % Start @ 100Hz, cross 200Hz at t=1sec 
%     specgram(y,128,1E3,128,120); % Display the spectrogram
%
%   EXAMPLE 3: Compute the spectrogram of a polynomial chirp.
%     t=[0 0.5 1.0 1.5 2.0]; % time breakpoints
%     f=[0 200 100 150 300];  % instantaneous frequency breakpoints
%     p=polyfit(t,f,4);      % fit 4th order polynomial over time
%     t=0:0.001:2;           % 2 secs @ 1kHz sample rate
%     y=chirp(t,p);
%     subplot(211); plot(t,polyval(p,t)); set(gca,'ylim',[0 500]);
%     subplot(212); specgram(y,128,1E3,128,120);
%
%   See also GAUSPULS, SAWTOOTH, SINC, SQUARE.

%   Author(s): D. Orofino, T. Krauss, 3/96
%   Copyright 1988-2000 The MathWorks, Inc.
%   $Revision: 1.7 $  $Date: 2000/06/09 22:03:53 $

% Parse inputs, and substitute for defaults:
error(nargchk(1,6,nargin));
if nargin<6, phi=[]; end
if nargin<5, method=[]; end
if nargin<4, f1=[]; end
if nargin<3, t1=[]; end
if nargin<2, f0=[]; end
if isempty(phi), phi=0; end
if isempty(method), method='linear'; end
if isempty(f1), f1=100; end
if isempty(t1), t1=1; end
if isempty(f0), f0=0; end

% Parse the method string:

if length(f0)>1,
   method='polynomial';
else
   % Set p=1 for linear, 2 for quadratic, 3 for logarithmic
   strs = {'linear','quadratic','logarithmic'};
   p = strmatch(lower(method),strs);
   if isempty(p),
      error('Unknown method selected.');
   elseif length(p)>1,
      error('Ambiguous method selected.');
   end
   method = strs{p};
end

switch method
case 'polynomial'
   % Polynomial chirp
   y = cos( 2*pi * polyval(polyint(f0),t) );
   
case {'linear','quadratic'},
  % Polynomial chirp: p is the polynomial order
  beta = (f1-f0).*(t1.^(-p));
  y = cos(2*pi * ( beta./(1+p).*(t.^(1+p)) + f0.*t + phi/360));
  
case 'logarithmic',
  % Logarithmic chirp:
  if f1<f0, error('F1>F0 is required for a log-sweep.'); end
  beta = log10(f1-f0)/t1;
  y = cos(2*pi * ( (10.^(beta.*t)-1)./(beta.*log(10)) + f0.*t + phi/360));
  
end

% [EOF] chirp.m<br><font></font><br></font></pre> </div></div>Not familiar with the function myself but I am sure others can guide you<br>