I need to code a signal.
조회 수: 2 (최근 30일)
이전 댓글 표시
There is a signal which I need to code.
how do I code it so that I can do operations such as shifting its time or scaling it etc.?
x(t) = t for 0<=t<=1
0 for other values of t.
I tried this but it does not work.
function y=x(time,timeshift)
t_length=length(time);
if(time(index)>=-timeshift)
if(time>0)&&(time<=1)
y(index)=time;
else
y(index)=0;
end
end
end
Please help.
답변 (2개)
Walter Roberson
2018년 9월 30일
syms t scale_signal = @(signal, scale_factor) signal * scale_factor; shift_time = @(signal, time_shift) symfun( signal(t-time_shift), t );
x(t) = piecewise(0 <= t & t <= 1, t, 0);
result(t) = scale_signal( shift_time( x, 0.75 ), 13 ) fplot(result,[-2 2])
댓글 수: 4
Walter Roberson
2018년 9월 30일
reverse_time = @(signal) symfun( signal(-t), t );
result(t) = scale_signal( shift_time( reverse_time(x), 0.75 ), 13 ) fplot(result,[-2 2])
Niyamul Islam Sajal
2021년 6월 21일
function y=x(time,timeshift)
t_length=length(time);
if(time(index)>=-timeshift)
if(time>0)&&(time<=1)
y(index)=time;
else
y(index)=0;
end
end
end
댓글 수: 1
Walter Roberson
2021년 6월 21일
index is not defined in the function.
What value is assigned to y(index) in the case that time(index) < -timeshift ?
참고 항목
카테고리
Help Center 및 File Exchange에서 Windows에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!