how can i plot these periodic function ?

I have zero knowledge in matlab and there is no time to learn from zero please help me!!

3 件のコメント

Steven Lord
Steven Lord 2022 年 5 月 29 日
This sounds like a homework assignment. If it is, show us the code you've written to try to solve the problem and ask a specific question about where you're having difficulty and we may be able to provide some guidance.
If you aren't sure where to start because you're not familiar with how to write MATLAB code, I suggest you start with the MATLAB Onramp tutorial (https://www.mathworks.com/support/learn-with-matlab-tutorials.html) to quickly learn the essentials of MATLAB.
If you aren't sure where to start because you're not familiar with the mathematics you'll need to solve the problem, I recommend asking your professor and/or teaching assistant for help.
eslam yasen
eslam yasen 2022 年 5 月 29 日
Actually it is, tommorow is the last day for submission and i dont have enought time .
I've tried to solve it with assistace of youtube and i findout it's useless .
I hope you understood my situation .
I really appreciate your words with the utmost respect .
Sam Chak
Sam Chak 2022 年 5 月 30 日
I understand your situation. Go back to the youtube video you watched and then type out the codes (paste them here).
Will see what can be done or improved from the codes you typed out.

サインインしてコメントする。

回答 (2 件)

Image Analyst
Image Analyst 2022 年 5 月 30 日

0 投票

You'll be able to do this in 2 hours if you do the 2 hour onramp course here:
Pratyush Swain
Pratyush Swain 2022 年 6 月 29 日

0 投票

Hi,
You can refer the given basic implementation for (a) and can follow similarly for (b) and (c).
%intialise the values of N%
x=[2,30,100,1000];
%some arbitrary values t taken for calc,here 2 values for taken t=0 and t=0.5%
T=[0,0.5];
%initialise the output(y) as 2-D array(4x4) each row corresponds to a t value%
y=zeros(4,4);
%loop for t values%
for t=T
%set row and ind(col) as 1%
ind=1;
row=1;
%loop over all the N values%
for n = x
sum=0;
%calculate the val of func using n & t %
for i = 1:n
multiplier=(-1).^(n+1);
multiplier=multiplier*1/(2*n-1);
output=multiplier*cos((2*n-1)*pi*t);
sum=sum+output;
end
sum=sum*12/pi;
%finally store the value in y%
y(row,ind)=sum;
ind=ind+1;
end
ind=1;
row=row+1;
end
%plot to realise the values for N=[..] over t=0 and t=1/2%
plot(x, y(1,:), x, y(2,:), '.-'), legend('t=0', 't=1/2')
Hope this helps !

カテゴリ

ヘルプ センター および File ExchangeMathematics についてさらに検索

製品

リリース

R2020a

タグ

質問済み:

2022 年 5 月 29 日

回答済み:

2022 年 6 月 29 日

Community Treasure Hunt

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

Start Hunting!

Translated by