Info

This question is closed. Reopen it to edit or answer.

Can any one help me?

1 view (last 30 days)
Kuheli Mondal
Kuheli Mondal on 4 Apr 2016
Closed: MATLAB Answer Bot on 20 Aug 2021
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

Answers (1)

Walter Roberson
Walter Roberson on 4 Apr 2016
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.

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!