フィルターのクリア

How to draw tangent plot?

27 ビュー (過去 30 日間)
Alicja
Alicja 2022 年 12 月 12 日
回答済み: David Hill 2022 年 12 月 12 日
I have to print tangent function in a range from 0 to 2*pi and I dont know how to do that as tangent goes to infinity at some points. Here's my code, could anyone help please?
t = 0:0.01:2*pi;
y = tan(t);
plot(t,y)
xlabel('x')
ylabel('y=tan')
grid on

回答 (2 件)

C B
C B 2022 年 12 月 12 日
t = 0:0.01:2*pi;
y = tan(t);
plot(t,y)
xlabel('x')
ylabel('y=tan')
axis([0 2*pi -5 5]) % set the x-axis to go from 0 to 2*pi, and the y-axis to go from -5 to 5
grid on

David Hill
David Hill 2022 年 12 月 12 日
fplot(@tan,[0,2*pi])

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by