What's my error trying to plot

3 Ansichten (letzte 30 Tage)
Lauren Fuentes
Lauren Fuentes am 30 Jun. 2020
Kommentiert: Lauren Fuentes am 1 Jul. 2020
Fs = 100;
t = (1:100)/Fs;
s1 = sin(2*pi*t*5); s2=sin(2*pi*t*15); s3=sin(2*pi*t*30);
s = s1+s2+s3;
[b,a] = ellip(4,0.1,40,[10 20]*2/Fs);
[H,w] = freqz(b,a,512) and plot(w*Fs/(2*pi),abs(H));
sf = filter(b,a,s);
S = fft(s,512);
SF = fft(sf,512);
w = (0:255)/256*(Fs/2);
plot(w,abs([S(1:256)' SF(1:256)']))
  2 Kommentare
Adam Danz
Adam Danz am 30 Jun. 2020
If you have a question about an error message, you need to include the full copy-pasted error message.
Lauren Fuentes
Lauren Fuentes am 1 Jul. 2020
Thanks for the clarification, I'll make sure to do so next time around...

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Gurpreet Singh
Gurpreet Singh am 30 Jun. 2020
Hi Lauren,
This error is occurring because of line 6. There should be delimeter instead of "and".
It should be as follows.
Fs = 100;
t = (1:100)/Fs;
s1 = sin(2*pi*t*5); s2=sin(2*pi*t*15); s3=sin(2*pi*t*30);
s = s1+s2+s3;
[b,a] = ellip(4,0.1,40,[10 20]*2/Fs);
[H,w] = freqz(b,a,512) ; plot(w*Fs/(2*pi),abs(H));
sf = filter(b,a,s);
S = fft(s,512);
SF = fft(sf,512);
w = (0:255)/256*(Fs/2);
plot(w,abs([S(1:256)' SF(1:256)']))

Weitere Antworten (1)

SC
SC am 30 Jun. 2020
is the error you are getting:
"Invalid expression. Check for missing multiplication operator,
missing or unbalanced delimiters, or other syntax error. To
construct matrices, use brackets instead of parentheses." ?
This maybe because of 'and' in your code at line:6
Try the following:
Fs = 100;
t = (1:100)/Fs;
s1 = sin(2*pi*t*5); s2=sin(2*pi*t*15); s3=sin(2*pi*t*30);
s = s1+s2+s3;
[b,a] = ellip(4,0.1,40,[10 20]*2/Fs);
[H,w] = freqz(b,a,512);
plot(w*Fs/(2*pi),abs(H));
sf = filter(b,a,s);
S = fft(s,512);
SF = fft(sf,512);
w = (0:255)/256*(Fs/2);
plot(w,abs([S(1:256)' SF(1:256)']))

Kategorien

Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2014a

Community Treasure Hunt

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

Start Hunting!

Translated by