如何制作具有频率和幅度的正弦信号

how to do a sinusoidal signal with frequency and amplitude

我需要创建一个振幅为 5 厘米、频率为 0.8 赫兹的正弦信号。

请帮忙

我的代码:

A=5;fs=0.8;
te=1/fs;
t=0:te:0.8;
s=A*sin(2*pi*fs*t);
plot(s,t)

当我绘制时,没有任何结果

我可以向您建议以下解决方案:

 f = 0.8;
 t = linspace(0,f,1000);
 a = 4;
 y = a*sin(2*pi*f*t);
 plot(t,y)

 function [ ] = singen(f, amp)
clf;

t = linspace(0,1/f,1000);

x=amp*sin(2*pi*f*t);

plot(t, x);
xlabel('Time (seconds)');
ylabel('Amplitude');
h = strcat({'Sinusoid of '}, num2str(freq), {'Hz with fs = '}, num2str(fs), {' Hz'});
title(h), grid on;
end