1

您好,我正在尝试创建一个标题,其中包含我的正弦波方程和变量。

% Set up initial parameters    
pi = 3.14;      % Make a variable called pi, and set it equal to 3.14    
A = 1985;       % Set the amplitude (A) equal to 5    
f = 7/3;        % Set the frequency (f) equal to 10    
p = pi/9;       % Set the phase (p) equal to 0    

% Create a time axis    
dt = 0.1;                    % Set the time step to be relatively small     
t = [0 : dt : 2.*pi];        % Create a list of time points from 0 thrugh 2*pi in steps of dt       

% Calculate the sine wave    
y = A.*sin(f.*t+p);   

y

% Graphical Display    
plot(t,y,'ko-')    
xlabel('Time, sec', 'fontsize', 6)    
ylabel ('Amplitude', 'fontsize', 6)

strA = msprintf('%1.1f', A);    
strf = msprintf('%1.1f', f);    
strp = msprintf('%1.1f', p);    
titlestr = 'y = ' + strA +' .* sin( ' + strf + ' .* t + ' + strp + ')'    
title(titlestr, 'fontsize', 6)

这是我到目前为止所做的。绘制这个方程时,我没有得到标题。请帮忙。

谢谢你。

4

1 回答 1

0

Which version of Scilab are you using ? It works for me with 5.4.0.

By the way, you should use %pi instead of declaration pi and Scilab uses // for comments, not %

于 2012-10-23T05:27:22.583 回答