why is my output does not change ?

조회 수: 3 (최근 30일)
tomer polsky
tomer polsky 2018년 6월 28일
댓글: tomer polsky 2018년 6월 28일
hello I want to write a code for shifting a signal : so lets suppose I have this signal : x(n) and i want to move it like this x(n-2) so this my main code :
clc; clear all; close all;
x=[2 3 0 -5 2 1]
m=2
n=[-1:4]
k=-1
%shift signal x(2-k)
[n_y,y] = shift_signal_by_k(x,m,n,k)
and this is my function shift_signal_by_k:
function [n_y,y] = shift_signal_by_k(x,m,n,k)
if (k<0)
if(n>0)
n_y=m+flip(-n)
disp('n') %%h(m-k)
y=flip(x);
elseif(n<0)
n_y=n-m;
y=flip(x);
else(n==0)
n_y=n
y=flip(x)
end
end
end
how ever my new n after shifting by 2 stays the same ? why ?
  댓글 수: 1
tomer polsky
tomer polsky 2018년 6월 28일
never mind i found my mistake thank you

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Hilbert and Walsh-Hadamard Transforms에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by