String 正弦波串接

String 正弦波串接,string,string-concatenation,scilab,String,String Concatenation,Scilab,您好,我正试图创建一个标题,其中包括我的正弦波方程与变量 % 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 =

您好,我正试图创建一个标题,其中包括我的正弦波方程与变量

% 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)
以下是我迄今为止所做的工作。 绘制这个方程时,我没有得到标题。 请帮忙


谢谢。

您正在使用哪个版本的Scilab?它适用于我的5.4.0

顺便说一下,您应该使用%pi而不是声明pi,Scilab使用//作为注释,而不是%