0
$\begingroup$

Does these codes hold true for up sampling and down sampling processes?

%for up sampling

unction Y = upsmpl(X,L)
 %X : input sampled signal
 %L  : up sampling rate
 n = length(X);
 Y = zeros(1,n*L+1);
 for i = 1:n
     Y(L*i+1)=X(i);
 end
 stem(Y)
end

%for down sampling

function Y = dnsampl(X,T)
%X : input sampled signal
%T : down sampling rate

for i=1:length(X)
    if(T*i<length(X))
        Y(i) = X(T*i);
    end
end

end
$\endgroup$
  • 2
    $\begingroup$ Hi! Welcome here! Two things: 1. please format your code using the code formatting button, right in the question editor! (You can do that, no matter whether you're on a phone or a "proper" computer, it's a single tap/click.) You clearly haven't tried to read your own question after you've submitted it. 2. We're not really in the business of doing Matlab code review. I'm sure you've tested your own code before asking us, so what were your testing results? What's the signal processing question you're asking us? $\endgroup$ – Marcus Müller Sep 6 '20 at 15:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.