What's my error trying to plot

3 vues (au cours des 30 derniers jours)
Lauren Fuentes
Lauren Fuentes le 30 Juin 2020
Commenté : Lauren Fuentes le 1 Juil 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 commentaires
Adam Danz
Adam Danz le 30 Juin 2020
If you have a question about an error message, you need to include the full copy-pasted error message.
Lauren Fuentes
Lauren Fuentes le 1 Juil 2020
Thanks for the clarification, I'll make sure to do so next time around...

Connectez-vous pour commenter.

Réponse acceptée

Gurpreet Singh
Gurpreet Singh le 30 Juin 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)']))

Plus de réponses (1)

SC
SC le 30 Juin 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)']))
  1 commentaire
Lauren Fuentes
Lauren Fuentes le 30 Juin 2020
Thank you so much!

Connectez-vous pour commenter.

Catégories

En savoir plus sur Resizing and Reshaping Matrices dans Help Center et File Exchange

Tags

Produits


Version

R2014a

Community Treasure Hunt

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

Start Hunting!

Translated by