- The desired filter causes errors since frequency zero as first stop frequency is not supported.
- Frequencies have to be given as normalized values using option 'Fst1,Fp1,Fp2,Fst2,Ast1,Ap,Ast2'
- Function filter() does not support fdesign-objects; the filter has to be designed first applying one of the available methods (see design() as reference, an example is given in the matlab help in fdesign.bandpass )
Pre-amplification, filtering and amplification
2 views (last 30 days)
Show older comments
Hey everyone. I am attempting to create a matlab code to filter and further analyze EMG signals. As of right now, I keep receiving this error: "Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters". This happens after I denote the variable Filtered as filter(d,SA). My code is shown below. I any of you guys can help me with this particular problem and give some input on what do you think about it, I highly appreciate.
SN = 1; %Chooses the gain which will equal to the desired input voltage or impedance SA= CH1.* 10^(SN/20); %signal amplification figure(2) plot(SA)
D = fdesign.bandpass('Fst1,Fp1,Fp2,Fst2,Ast1,Ap,Ast2', ... 0,15,500,515,60,1,60); %values for band pass filter Filtered = filter(d,SA); %applying filter to amplified data freq = 0:(2*pi)/length(CH1):pi; %frequency vector xdft = fft(SA); %discrete fourier transform ydft = fft(Filtered); %discrete fourier transform plot(freq/pi,abs(xdft(1:length(CH1)/2+1))) hold on plot(freq/pi,abs(ydft(1:length(CH1)/2+1))) hold off xlabel('Normalized Frequency (\times\pi rad/sample)') legend('Original Signal','Bandpass Signal')
SN = 3; %Chooses the gain which will equal to the desired input voltage or impedance FSA= Filtered.* 10^(SN/20); %signal amplification for later analysis figure(2) plot(FSA)
0 Comments
Answers (1)
Robert U
on 12 Nov 2018
Hello Ricardo Whitaker:
I assume the CH1 signal is a vector of doubles.
Kind regards,
Robert
0 Comments
See Also
Categories
Find more on Analog Filters in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!