필터 지우기
필터 지우기

How to code these two signals

조회 수: 2 (최근 30일)
Muhammad Atif
Muhammad Atif 2020년 4월 6일
댓글: Ameer Hamza 2020년 4월 17일
I have two signal need to write a program in picture, in which v(t) is uniformaly distributed within[0,0.1] over the interval [0,20].where a=0.2 and l=5. Can anybody help me to write a code for this???

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 4월 6일
Try this
rng(0);
t = linspace(0,20,1000);
a = 0.2;
l = 5;
v = 0.1*rand(size(t));
w = zeros(size(t));
mask = 5 < t & t < 5+l./v;
w(mask) = a*pi*v(mask)/l.*sin(2*pi*v(mask)/l.*t(mask));
plot(t,w)
  댓글 수: 4
Muhammad Atif
Muhammad Atif 2020년 4월 17일
편집: Muhammad Atif 2020년 4월 17일
hi sir! I want to plot a uniformely distributed random noise between [0,0.1] for the interval 0 to 20 and the whole interval is 0 to 30? I'm trying to run this code but did not give any plot. Can you tell me where I made the mistake???
t1 = linspace(0,30,1000);
r=zeros(size(t1));
if t1>=0 & t1<=20
r = r = 0.1*rand(size(t1));
end
plot(t1,r)
Ameer Hamza
Ameer Hamza 2020년 4월 17일
try this
t1 = linspace(0,30,1000);
r = 0.1*rand(size(t1));
r = r.*(t1<20);
plot(t1,r)

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Signal Generation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by