フィルターのクリア

I need to code a signal.

1 回表示 (過去 30 日間)
Pranava J K
Pranava J K 2018 年 9 月 30 日
コメント済み: Walter Roberson 2021 年 6 月 21 日
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.
  1 件のコメント
KALYAN ACHARJYA
KALYAN ACHARJYA 2018 年 9 月 30 日
Check here

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

回答 (2 件)

Walter Roberson
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 件のコメント
Pranava J K
Pranava J K 2018 年 9 月 30 日
How do I reverse the time of the signal, i.e. a mirror image along the y-axis
Walter Roberson
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
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
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 ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by