Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Low Pass Filter to filter out harmonics from a signal. (MATLAB CODE)

Status
Not open for further replies.

Prosenjit101

Newbie level 5
Joined
Apr 18, 2013
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Dhaka, Bangladesh
Activity points
1,349
I need a MATLAB code to
promt the user to enter a sinusoid signal
ex: x= 3*sin(2*pi*50*t) + 3*sin(2*pi*100*t) + 3*sin(2*pi*200*t) + 3*sin(2*pi*400*t)
and if any other variables are needed from the user.
then display the signal in time domain and frequency domain.
and then apply a low pass filter,
to filter out the harmonics from the signal and then display the signal with the fundamental frequency.
 

but keep in mind that the filter is designed for cut off frequency equal to 50 Hz
 

Attachments

  • filter_harmonics1.txt
    770 bytes · Views: 72

very useful. But in a situation where you have your data already and you want to filter the noise, is the same code applicable??. because this seems to generate its own data and then apply the filter.
 

you can reference this code
 

Attachments

  • abc.txt
    923 bytes · Views: 71

Thanks so much sir, I was still a little bit confused being a new learner of matlab. Attached are my data and image I got from the Oscilloscope. From the code you sent sir, I couldnt see where to enter my data. kindly give me a little guidiance. thanks so much for taking your time sir.
EDA2.png,
-7.3485
-10.1485
-74.9485
-73.7485
-67.7485
-68.5485
-70.9485
-66.9485
-65.7485
-68.5485
-66.9485
-65.7485
-61.3485
-56.1485
-57.7485
-64.9485
-66.9485
-67.7485
-66.1485
-74.9485
-74.9485
-65.7485
-68.5485
-73.7485
-73.7485
-65.3485
-65.7485
-65.7485
-66.1485
-61.3485
-57.3485
-60.5485
-62.9485
-68.9485
-65.7485
-69.7485
-68.9485
-70.9485
-60.9485
-60.9485
-74.9485
-66.1485
-73.7485
-73.7485
-64.5485
-62.9485
-69.7485
-66.9485
-73.7485
-74.9485
-74.9485
-66.9485
-67.7485
-59.7485
-60.5485
-64.9485
-64.9485
-65.3485
-63.7485
-63.7485
-63.3485
-65.7485
-61.3485
-60.5485
-74.9485
-62.5485
-58.1485
-60.1485
-62.1485
-63.3485
-65.3485
-73.7485
-70.9485
-71.3485
-64.5485
-74.9485
-69.7485
-62.5485
-62.9485
-67.7485
-63.7485
-65.3485
-70.9485
-69.7485
-74.9485
-70.9485
-59.3485
-61.7485
-58.5485
-58.1485
-66.9485
-67.7485
-67.7485
-66.9485
-61.3485
-65.3485
-60.5485
-62.9485
-54.9485
-24.5485
-18.1485
-24.1485
-66.9485
-61.7485
-59.3485
-64.9485
-60.9485
-59.7485
-66.1485
-74.9485
-65.3485
-60.9485
-60.9485
-60.5485
-68.9485
-74.9485
-60.9485
-56.1485
-58.5485
-69.7485
-65.7485
-68.5485
-57.7485
-66.9485
-66.9485
-74.9485
-71.3485
-64.5485
-65.7485
-68.5485
-74.9485
-74.9485
-67.7485
-67.7485
-69.7485
-71.3485
-64.5485
-60.5485
-71.7485
-60.9485
-57.7485
-63.7485
-62.9485
-64.9485
-64.9485
-63.7485
-74.9485
-69.7485
-64.5485
-56.5485
-56.5485
-59.3485
-59.3485
-60.9485
-63.3485
-64.9485
-61.7485
-74.9485
-63.7485
-66.9485
-61.7485
-65.3485
-73.7485
-66.9485
-74.9485
-69.7485
-68.9485
-66.1485
-64.1485
-68.5485
-69.7485
-74.9485
-64.5485
-63.7485
-68.5485
-63.7485
-63.7485
-64.9485
-67.7485
-63.7485
-62.9485
-63.7485
-63.7485
-63.7485
-59.3485
-60.1485
-60.1485
-56.1485
-56.1485
-66.9485
-57.3485
-68.5485
-64.9485
-64.9485
-61.7485
-57.7485
-50.5485
-48.9485
-43.3485
-23.3485
-15.7485
-20.5485
-45.3485
-48.9485
-50.1485
-58.1485
-60.9485
-62.1485
-63.7485
-66.9485
-59.7485
-58.9485
-56.5485
-56.1485
-58.9485
-64.9485
-61.7485
-74.9485
-70.9485
-74.9485
-63.7485
-60.1485
-60.1485
-60.5485
-65.3485
-64.9485
-73.7485
-69.7485
-73.7485
-74.9485
-66.9485
-62.9485
-61.3485
-64.1485
-70.9485
-74.9485
-62.5485
-58.1485
-62.9485
-66.9485
-66.9485
-66.9485
-59.3485
-62.9485
-74.9485
-65.3485
-70.9485
-71.7485
-60.1485
-60.5485
-66.9485
-73.7485
-68.5485
-61.7485
-65.7485
-69.7485
-74.9485
-63.7485
-73.7485
-65.7485
-73.7485
-64.5485
-65.7485
-66.9485
-71.7485
-70.9485
-67.7485
-70.9485
-74.9485
-67.7485
-63.3485
-66.9485
-66.1485
-74.9485
-65.3485
-63.7485
-71.7485
-62.9485
-64.5485
-68.9485
-68.5485
-66.1485
-70.9485
-70.9485
-65.3485
-65.3485
-59.3485
-58.5485
-67.7485
-66.1485
-74.9485
-62.9485
-59.7485
-63.7485
-60.9485
-58.1485
-60.9485
-68.9485
-49.3485
-30.1485
-22.1485
-26.5485
-48.1485
-57.7485
-58.1485
-62.5485
-71.7485
-63.7485
-66.9485
-64.9485
-65.3485
-68.9485
-73.7485
-61.7485
-61.7485
-64.9485
-74.9485
-62.9485
-60.9485
-64.5485
-66.1485
-64.5485
-66.9485
-66.1485
-59.3485
-66.9485
-68.9485
-63.7485
-60.5485
-62.1485
-65.7485
-74.9485
-62.9485
-64.9485
-62.9485
-60.1485
-61.7485
-63.7485
-62.5485
-62.9485
-69.7485
-68.5485
-74.9485
-68.5485
-64.9485
-61.7485
-62.9485
-64.9485
-64.9485
-69.7485
-66.9485
-61.7485
-66.1485
-66.9485
-61.7485
-60.1485
-63.7485
-71.7485
-66.9485
-73.7485
-65.3485
-61.7485
-67.7485
-74.9485
-64.5485
-63.3485
-69.7485
-74.9485
-73.7485
-74.9485
-69.7485
-62.9485
-69.7485
-64.9485
-68.5485
-67.7485
-74.9485
-74.9485
-69.7485
-64.5485
-65.3485
-69.7485
-69.7485
-64.5485
-70.9485
-67.7485
-73.7485
-61.7485
-58.9485
-62.9485
-65.3485
-60.9485
-64.9485
-60.1485
-62.1485
-65.3485
-74.9485
-69.7485
-54.9485
-40.5485
-32.1485
-35.7485
-52.1485
-69.7485
-60.5485
-74.9485
-66.9485
-71.7485
-66.1485
-68.5485
-74.9485
-68.5485
-62.9485
-61.7485
-61.7485
-66.1485
-62.5485
-58.9485
-60.9485
-73.7485
-65.7485
-69.7485
-65.3485
-62.9485
-63.7485
-71.7485
-61.7485
-56.5485
-56.1485
-61.3485
-68.5485
-66.9485
-60.9485
-64.9485
-74.9485
-64.5485
-64.5485
-63.7485
-66.1485
-66.9485
-71.3485
-65.3485
-74.9485
-63.7485
-62.1485
-65.7485
-71.7485
-67.7485
-62.9485
-60.5485
-60.9485
-62.1485
-62.5485
-60.9485
-74.9485
-73.7485
-62.9485
-60.1485
-59.7485
-60.9485
-60.5485
-64.9485
-73.7485
-63.7485
-61.7485
-64.1485
-63.7485
-62.9485
-67.7485
-74.9485
-70.9485
-66.1485
-70.9485
-61.7485
-63.7485
-65.3485
-63.7485
-66.9485
-63.3485
-68.9485
-64.9485
-64.5485
-63.7485
-61.3485
-61.7485
-66.1485
-62.5485
-64.9485
-66.9485
-71.3485
-69.7485
-66.1485
-68.5485
-60.9485
-55.3485
-58.5485
-66.1485
-59.3485
-48.1485
-35.3485
-26.1485
-29.3485
-45.7485
-57.3485
-55.7485
-58.5485
-60.9485
-59.7485
-63.7485
-62.9485
-60.5485
-68.9485
-74.9485
-62.9485
-64.9485
-71.7485
-65.7485
-73.7485
-68.5485
-65.7485
-68.9485
-69.7485
-63.7485
-61.3485
-63.7485
-71.3485
-74.9485
-62.9485
-66.9485
-74.9485
-68.5485
-62.5485
-60.1485
-63.3485
-65.3485
-58.9485
-58.1485
-63.7485
-73.7485
-61.7485
-61.7485
-62.1485
-62.9485
-63.7485
-62.9485
-60.1485
-61.3485
-56.5485
-61.3485
-71.3485
-63.7485
-60.9485
-65.3485
-74.9485
-63.7485
-61.3485
-70.9485
-66.9485
-60.1485
-58.9485
-61.7485
-74.9485
-66.9485
-63.3485
-58.5485
-56.9485
-57.7485
-58.9485
-65.3485
-63.7485
-58.5485
-62.5485
-74.9485
-71.7485
-66.9485
-63.7485
-66.1485
-74.9485
-66.9485
-70.9485
-66.9485
-68.9485
-65.7485
-65.3485
-73.7485
-65.3485
-60.1485
-59.7485
-66.1485
-74.9485
-69.7485
-71.3485
-64.9485
-61.7485
-59.7485
-60.9485
-66.9485
-67.7485
-51.3485
-39.3485
-29.3485
-31.7485
-47.7485
-60.1485
-59.7485
-62.9485
-63.3485
-68.9485
-67.7485
-63.7485
-62.9485
-71.3485
-70.9485
-66.9485
-62.9485
-65.3485
-60.9485
-58.5485
-61.7485
-65.3485
-70.9485
-73.7485
-69.7485
-59.7485
-57.7485
-62.5485
-73.7485
-70.9485
-74.9485
-65.7485
-61.7485
-64.9485
-64.5485
-65.7485
-71.7485
-63.7485
-61.7485
-58.5485
-64.5485
-74.9485
-74.9485
-65.3485
-62.9485
-62.9485
-65.3485
-66.1485
-60.9485
-57.3485
-61.3485
-66.9485
-62.1485
-63.7485
-62.9485
-62.9485
-62.5485
-64.1485
-73.7485
-73.7485
-68.5485
-62.9485
-60.5485
-68.5485
-63.7485
-60.5485
-62.9485
-74.9485
-61.7485
-55.7485
-60.9485
-65.7485
-64.9485
-69.7485
-58.1485
-57.7485
-64.9485
-65.7485
-65.7485
-66.1485
-68.5485
-73.7485
-68.9485
-74.9485
-74.9485
-66.9485
-73.7485
-66.1485
-64.9485
-64.9485
-67.7485
-69.7485
-73.7485
-71.7485
-73.7485
-62.9485
-59.7485
-58.5485
-70.9485
-70.9485
-52.9485
-46.5485
-34.9485
-36.5485
-50.5485
-64.5485
-60.1485
-66.1485
-64.1485
-62.9485
-68.5485
-65.3485
-60.9485
-74.9485
-73.7485
-65.3485
-64.5485
-70.9485
-74.9485
-71.7485
-63.7485
-66.9485
-64.9485
-60.5485
-59.3485
-68.5485
-66.9485
-66.9485
-63.7485
-62.5485
-65.3485
-73.7485
-73.7485
-66.9485
-62.9485
-66.1485
-66.1485
-69.7485
-71.7485
-66.9485
-64.5485
-63.7485
-63.7485
-66.9485
-61.7485
-67.7485
-66.1485
-59.7485
-58.5485
-57.7485
-61.3485
-59.7485
-62.1485
-63.7485
-69.7485
-68.5485
-60.9485
-66.1485
-64.9485
-74.9485
-69.7485
-61.7485
-61.3485
-66.9485
-62.1485
-68.5485
-66.9485
-62.1485
-63.7485
-69.7485
-68.5485
-65.7485
-65.3485
-66.1485
-68.5485
-60.9485
-65.7485
-65.3485
-70.9485
-66.9485
-67.7485
-61.7485
-66.9485
-63.7485
-73.7485
-67.7485
-67.7485
-59.3485
-56.9485
-60.1485
-60.1485
-62.9485
-74.9485
-74.9485
-66.9485
-63.7485
-58.1485
-58.9485
-64.9485
-70.9485
-52.9485
-47.3485
-36.5485
-37.7485
-49.7485
-66.1485
-58.9485
-59.3485
-68.5485
-58.1485
-61.7485
-68.5485
-71.3485
-70.9485
-66.9485
-62.9485
-60.9485
-62.5485
-66.9485
-73.7485
-64.5485
-71.3485
-61.7485
-62.5485
-65.3485
-58.9485
-56.9485
-64.9485
-62.5485
-65.7485
-66.9485
-66.1485
-74.9485
-60.9485
-56.5485
-56.9485
-65.7485
-68.5485
-60.1485
-58.1485
-62.9485
-73.7485
-69.7485
-64.9485
-65.3485
-65.7485
-64.9485
-62.5485
-61.7485
-54.1485
-54.1485
-60.9485
-66.1485
-70.9485
-63.7485
-60.1485
-59.7485
-73.7485
-66.9485
-74.9485
-70.9485
-65.3485
-62.9485
-74.9485
-63.7485
-68.5485
-62.1485
-65.3485
-63.7485
-65.7485
-68.5485
-74.9485
-74.9485
-71.3485
-60.1485
-59.3485
-62.9485
-64.9485
-68.9485
-69.7485
-70.9485
-67.7485
-64.9485
-64.5485
-62.9485
-64.5485
-68.9485
-73.7485
-67.7485
-69.7485
-66.9485
-66.9485
-64.5485
-62.9485
-59.3485
-70.9485
-60.9485
-62.1485
-68.5485
-68.5485
-64.9485
-56.1485
-46.1485
-47.3485
-59.3485
-70.9485
-62.9485
-64.9485
-73.7485
-69.7485
-62.5485
-64.9485
-69.7485
-74.9485
-74.9485
-74.9485
-69.7485
-70.9485
-73.7485
-61.7485
-57.7485
-62.9485
-70.9485
-74.9485
-66.9485
-61.7485
-63.7485
-70.9485
-66.9485
-60.1485
-61.3485
-71.7485
-71.3485
-64.9485
-62.9485
-63.7485
-66.9485
-74.9485
-65.3485
-64.9485
-64.9485
-62.5485
-66.9485
-68.5485
-64.9485
-62.9485
-61.7485
-65.3485
-66.1485
-54.1485
-52.9485
-59.7485
-65.3485
-69.7485
-63.3485
-61.3485
-68.9485
-68.5485
-61.3485
-64.9485
-74.9485
-73.7485
-73.7485
-65.3485
-65.7485
-64.9485
-60.1485
-60.1485
-63.7485
-66.9485
-66.9485
-60.9485
-58.9485
-62.9485
-66.9485
-58.9485
-63.3485
-63.7485
-63.7485
-66.9485
-63.7485
-61.7485
-62.9485
-67.7485
-74.9485
-74.9485
-70.9485
-63.7485
-54.9485
-56.5485
-64.5485
-67.7485
-68.9485
-66.1485
-73.7485
-61.3485
-58.1485
-61.3485
-69.7485
-73.7485
-61.7485
-62.5485
-50.5485
-52.1485
-62.9485
-73.7485
-60.9485
-57.7485
-62.1485
-70.9485
-68.9485
-65.3485
-68.9485
-66.1485
-61.7485
-62.1485
-61.7485
-71.3485
-64.9485
-63.7485
-73.7485
-67.7485
-74.9485
-68.5485
-63.7485
-65.7485
more info: Record Length 1.02E+03
Sample Interval 1.23E+00
Trigger Point 0.00E+00

How do I highlight the fundamental frequency and remove all the harmonics. In my result, I am surpose to only present the fundamental frequency and eliminate the harmonic by using filter.
 

in signal processing, y(n)= x(n)* h(n).
using fft : Y(f) = X(f) x H(f). LPF is a filter where H(f)=1 for =-fc < f < fc. anh H(f)=0 if otherwise.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top