how to write equation given below to find corresponding plot?

equation is given here
s(x)=(2a/T)*(x) when 0<=x<=T/2;
=2a*(1-x/T) when T/2<=x<=T;
here a=0.1 and T=20

 採用された回答

Star Strider
Star Strider 2017 年 7 月 6 日

0 投票

Try this:
a = 0.1;
T = 20;
s = @(x) (2*a*x/T) .* (0<=x & x<=T/2) + (2*a*(1-x/T)) .* (T/2<=x & x<=T);
x = linspace(0, 20);
sv = s(x);
figure(1)
plot(x,sv)
hold on
for k1 = 20:20:60
plot((x+k1),sv)
end
hold off

6 件のコメント

ajeet verma
ajeet verma 2017 年 7 月 6 日
thankyou sir , one more thing, i want to create this plot in two dimension image, how to do?
ajeet verma
ajeet verma 2017 年 7 月 6 日
please sir give me reply
Star Strider
Star Strider 2017 年 7 月 6 日
My pleasure.
‘i want to create this plot in two dimension image’
It is a two dimension plot. I have no idea what other result you want. Do you have an example?
ajeet verma
ajeet verma 2017 年 7 月 7 日
sir i want to convert that triangular waveform into triangular fringe pattern, i have an example given below %sinusoidal wave form t=0:1/100:1; f=5; I=sin(2*pi*f*t); plot(I); % sinusoidal fringe pattern m=1000; % rows n=1000; % column f1=20; % No. of vertical fringes f2=0; % No. of horizontal fringes for i=1:m for j=1:n a(i,j)=sin(2*pi*(f1*j/n+f2*i/m)); end end imshow(a,[])
ajeet verma
ajeet verma 2017 年 7 月 7 日
please see attached file
Star Strider
Star Strider 2017 年 7 月 7 日
I believe I already addressed this in your other Question.

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by