Info
此问题已关闭。 请重新打开它进行编辑或回答。
I want to generate a sinusoidal signal with following lines of programme. It shows the error "Matrix dimensions must agree." Why is this error and what is the solution?
1 次查看(过去 30 天)
显示 更早的评论
N=512; %length of the signal n=0:N-1; phase=30; phase_in_rad=degtorad(phase); final_phase=phase_in_rad*(1:9);
x=sin(2*pi*(25/N)*n+(final_phase))+sin(2*pi*(60/N)*n+(final_phase))+cos(2*pi*(110/N)*n-(final_phase));
figure; subplot(2,1,1); plot(x,'g') grid on; xlabel('Samples'); ylabel('Amplitude of the signal'); title('Main Signal');
xf=fft(x);
xfmag=10*log10(abs(xf));
subplot(2,1,2); plot(abs(xf),'r') grid on; xlabel('Samples'); ylabel('Amplitude'); title('Absolute value of FFT of x');
0 个评论
回答(0 个)
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!