我正在尝试运行此视频中描述的示例:https://www.youtube.com/watch?v=NRKxa8V8RWc
MATLAB脚本应如下所示:
%% Plot the sum of cosines
t=linspace(0,pi/2,1000);
f1=10;
f2=12;
y1=cos(2*pi*f1*t);
y2=cos(2*pi*f2*t);
y3=y1+y2;
figure;
hold on;
plot(t,y3)
%% Add the envelope to the plot
envelope = [2*cos(pi*(f1.f2)*t); 2*cos(pi*(f1*f2)*t.pi)];
plot(t,envelope)
axis tight
问题:
在“将信封添加到地块的步骤”中有一个。 “(f1.f2)”和“ t.pi”处的运算符]
根据视频,它应该可以与点一起使用,但是由于我尝试了点字符并且无法正常工作,所以我找不到合适的点运算符
它不是.
运算符,它只是减号。换行:
envelope = [2*cos(pi*(f1-f2)*t); 2*cos(pi*(f1-f2)*t-pi)];
您应该得到:
为什么要减号,您应该检查beat phenomenon