Info

此问题已关闭。 请重新打开它进行编辑或回答。

Can any one help me?

1 次查看(过去 30 天)
Kuheli Mondal
Kuheli Mondal 2016-4-4
关闭: MATLAB Answer Bot 2021-8-20
how to solve this error?
??? Error: File: noise.m Line: 31 Column: 10
Unexpected MATLAB expression.
My mat lab code is
function x=signal(f,fs,N)
% sinusoid
f=30; %frequency,
N=20; %number of samples
fs=100; %sampling frequency
A=2; %amplitute
%Total sampling time = 1 second
n = 0:N-1; % numbering the samples
x = A*sin(2*pi*f*n/fs);
subplot(2,1,1);
plot(x)
title('Noise signal (x(n))')
axis([0,20,-2,2]);
ylabel('Amplitude');
xlabel('Discrete time n');
MFx = abs(fft(x));
frek=(0:N/2-1)*fs/N;
subplot(2,1,2)
plot(frek,MFx(1:N/2),'m')% plot the positive frequencies
title('FFT of Noise signal (x(n))');
axis([0 40 0 100]);
ylabel('Frequency');
xlabel('No. of Iteration');
k=10;
h=zeros(1,k);
h(3)=1;
h(4)=-2.7083;
h(5)=4.1861;
h(6)=-3.0451;
h(7)=0.73071;
d(n)=h(3)x(n-3)+h(4)x(n-4)+h(5)x(n-5)+h(6)x(n-6)+h(7)x(n-7);
ff_mix = abs(fft(d,1024));
subplot(2,2,1);
plot(d(n))
title('input: 1 primary signal (d(n))')
axis([0,20,-6,6]);
ylabel('Amplitude');
xlabel('Discrete time n');
subplot(2,2,2);
plot(ff_mix,'m');
title('FFT of primary signal (d(n))');
axis([0 1000 0 100]);
ylabel('Frequency');
xlabel('No. of Iteration');
Thank you very much

回答(1 个)

Walter Roberson
Walter Roberson 2016-4-4
Your line
d(n)=h(3)x(n-3)+h(4)x(n-4)+h(5)x(n-5)+h(6)x(n-6)+h(7)x(n-7);
has nothing between the h(3) and the x that follows it. You have the same problem several times on that line.

标签

尚未输入任何标签。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by