필터 지우기
필터 지우기

How write a function that takes a matrix and period omega?

조회 수: 3 (최근 30일)
Pratik Patel
Pratik Patel 2020년 3월 15일
댓글: Sriram Tadavarty 2020년 3월 15일
function F = fftfuntion(D, omega)
%Input: a matrix D ∈ RN×2, Di = (xi,yi), and the period ω
check = 0;
x = D(:,1);
y = D(:,2);
end
I need to write a function that takes as input a matrix D RN×2, Di = (xi,yi), and the period ω. Here is what I have so far. Am I on the right track?

채택된 답변

Sriram Tadavarty
Sriram Tadavarty 2020년 3월 15일
Hi Prathik,
You are on the right track itself.
Ensure that you define the output variable F and use omega input in the function.
Regards,
Sriram
  댓글 수: 4
Pratik Patel
Pratik Patel 2020년 3월 15일
This is where it gets tricky... I need to return an output of a plot that uses the fft function to clean the noise. This function doesn't work when I test it against a dataset.
function F = fftfuntion(D, omega)
%Input: a matrix D ∈ RN×2, Di = (xi,yi), and the period ω
%Output a plot showing a fit of the data without noise.
%Do this by cleaning the noise in the frequency space.
check = 0;
x = D(:,1);
y = D(:,2);
t = 0:0.01:2*pi;
plot(t,x)
y = fft(x)
end
Sriram Tadavarty
Sriram Tadavarty 2020년 3월 15일
There are few things missed in the code. Why is omega not used? Should the fft(x) be F rather than y?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by