set the unit step function

1 visualizzazione (ultimi 30 giorni)
Tu Nguyen
Tu Nguyen il 2 Mar 2022
Risposto: David Hill il 2 Mar 2022
Dear all, how can I set the function like this: x[n] = [1 2 3 4 5 6] with correlation n = [0 1 2 3 4 5]?
Thank you so much for your help

Risposte (1)

David Hill
David Hill il 2 Mar 2022
Not sure what you are after. I assumed step function at n positions with applitudes 1:6
z=1:6;
n=0:5;
x=-1:.1:10;
scatter(x,d(x,z,n))
function y=d(x,z,n)
y=zeros(size(x));
for k=1:length(n)
y(ismember(x,n(k)))=z(k);
end
end

Categorie

Scopri di più su Behavior and Psychophysics in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by