Any other ways to program tan(x) between [-3*pi/2 to 3*pi/2])?
古いコメントを表示
Hello!
I write down the code for the tan(x) between [-3*pi/2 to 3*pi/2]), but I want to reduce it, or doing it in another way. Any ideas?
x1=-(3*pi/2)+0.01:0.01:-(pi/2)-0.01;
plot(x1,tan(x1),'r','linewidth',2.5)
hold on
x2=-(pi/2)+0.01:0.01:(pi/2)-0.01;
plot(x2,tan(x2),'r','linewidth',2.5)
x3=(pi/2)+0.01:0.01:(3*pi/2)-0.01;
plot(x3,tan(x3),'r','linewidth',2.5)
hold off
採用された回答
その他の回答 (1 件)
Azzi Abdelmalek
2013 年 7 月 13 日
x=-3*pi/2+0.01:0.01:-(pi/2)-0.01
y=tan(x)
y=[y nan y nan y]
x=linspace(x(1),pi/2-0.01,numel(y))
plot(x,y)
3 件のコメント
Mohammed Sayan
2013 年 7 月 13 日
Azzi Abdelmalek
2013 年 7 月 13 日
Look at x, you will see that x takes values near 0, if you want to be more closer to 0, you have to choose a very small sample time
Mohammed Sayan
2013 年 7 月 14 日
カテゴリ
ヘルプ センター および File Exchange で Performance and Memory についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

