Plotting a function over an interval- Unexpected output

8 ビュー (過去 30 日間)
Kleanthis-Marios Papadopoulos
Kleanthis-Marios Papadopoulos 2020 年 2 月 9 日
I need to plot this function and this is my code:
C=1.000e-7; %10^-7
x= [0:h:xf];
y=(2*pi*(2*pi*(exp(-10000*x))+(sin(20000*pi*x)))+cos(20000*pi*x))/ ( 2000000*(1+4*pi^2));
plot(x,y/C);
I expect to get a sinusoidal output scaled by 1/C. Instead I get what you can see in the picture. Can anyone tell me what am I doing wrong?
I am new to MATLAB so apologies for asking such a question.
plot.png
output.jpg

採用された回答

David Hill
David Hill 2020 年 2 月 9 日
C=1.000e-7; %10^-7
x= [0:.00001:.04];%need to plot smaller interval
y=(2*pi*(2*pi*(exp(-10000*x))+(sin(20000*pi*x)))+cos(20000*pi*x))/ ( 2000000*(1+4*pi^2));
plot(x,y/C);
  1 件のコメント
Kleanthis-Marios Papadopoulos
Kleanthis-Marios Papadopoulos 2020 年 2 月 11 日
Thank you. This seems to work correctly. The solution is part of numerical analysis coursework.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLanguage Fundamentals についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by