how to make a time shift function
3 views (last 30 days)
Show older comments
We were asked to create our own functions (m-file) like a general time shift function.
I'd imagine it like this but i ran into a problem on how would I shift the time.
function y = myTimeShift (X, shift, t)
% time shift function. X is a function of t given time (start:step:end).
????????????????? What is in here so that x(t) is now x(tshifted)?
in the command,
t = -5:0.1:5;
x = myStepfunc(1, t);
y = myTimeshift(x, -2, t);
plot (??,y);
The myStep function is from heaviside(t). only with changeable Amplitude A. see below.
function y = myStepfunc(A, t);
%Step function with Amplitde A, maximum time, and minimum time.
y=zeros(size(t));
y(t>0)= A;
y(t==0)=0.5;
end
0 Comments
Answers (0)
See Also
Categories
Find more on Graph and Network Algorithms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!