Repeating Half-range Cosine Function every pi?

Hello,
I want to plot half-range periodic cosine function of period (2*pi) between that repeats itself every (pi) from(-3*pi to 3*pi) with no connection between any sample. Any ideas?
Regards,

댓글 수: 4

your link is a bit tricky, what if contributors do not have a gmail account? At least for me, It was not possible to watch the plot from the link.
Jan
Jan 2013년 7월 12일
@mohammed: Please explain it with an "[EDITED]" tag, if you change the message. Now David's comment looks a little bit silly.
@David: I removed the plot because I afraid people think of it as a scam. For your knowledge I wrote the program in the last comment if you still willing to help. Thanks.
@Jan: I agree with you, I programmed it by myself and you can take a look at it. In case you have any ideas, would be appreciated. Thanks.

댓글을 달려면 로그인하십시오.

답변 (2개)

Jan
Jan 2013년 7월 12일

0 개 추천

How can a function be 1. between 0 and pi and 2. repeat from -3*pi to 3*pi?
I assume all you need is x=linspace..., y=cos... and plot(x, y, '.'). Therefore I suggest to try it by your own at first and ask a specific question if it does not work.
Mohammed Sayan
Mohammed Sayan 2013년 7월 12일

0 개 추천

Thanks for your comments, I tried it by myself but I don't like the way I programmed it because it is very explicit. Any good ideas?
x1=-3*pi:0.1:-2*pi;
y1=-cos(x1);
x2=-2*pi:0.1:-pi;
y2=cos(x2);
x3=-pi:0.1:0;
y3=-cos(x3);
x4=0:0.1:pi;
y4=cos(x4);
x5=pi:0.1:2*pi;
y5=-cos(x5);
x6=2*pi:0.1:3*pi;
y6=cos(x6);
plot(x1,y1,x2,y2,x3,y3,x4,y4,x5,y5,x6,y6)

카테고리

도움말 센터File Exchange에서 Performance and Memory에 대해 자세히 알아보기

질문:

2013년 7월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by