How do I write this function and plot it?

Hello, completely new at Matlab and completely stumped on this so any help would be appreciated. I've been given this function and have to plot it for the constant w=2 and the interval -4 to 4.
Thanks in Advance.

답변 (1개)

Rik
Rik 2017년 10월 27일

0 개 추천

There are many ways you can solve this. This approach is by no means the most efficient, fast or elegant, but I think it shows a step by step method.
w=1;
element=@(x,n) sin((2*n-1)*w*x)/(2*n-1);
f=@(x) 0;%initialize
for n=1:5
f=@(x) f(x)+element(x,n);
end
fplot(f,[0 pi])
If you have the symbolic toolbox, you will have many more options, but this is all in the Matlab base.

카테고리

도움말 센터File Exchange에서 Line Plots에 대해 자세히 알아보기

태그

질문:

2017년 10월 27일

답변:

Rik
2017년 10월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by