how to resize a given signal?

조회 수: 6 (최근 30일)
Sivakumaran Chandrasekaran
Sivakumaran Chandrasekaran 2013년 3월 25일
how to resize a given signal? My input signals are y2=[ 1 9385];yh=[1 37508]; I need to find y2+y5.
  댓글 수: 2
Azzi Abdelmalek
Azzi Abdelmalek 2013년 3월 25일
What is y5?
Walter Roberson
Walter Roberson 2013년 3월 25일
Do the signals occupy exactly the same time duration ?

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

답변 (2개)

Image Analyst
Image Analyst 2013년 3월 27일
편집: Image Analyst 2013년 3월 27일
You'll probably want to use either interp1() or imresize(). Both are illustrated in the demo below:
clc;
clearvars;
y2 = rand(1, 9385);
y5 = rand(1, 37508);
% The easiest method, using imresize().
% Make y2 the same size as y5
y2Larger = imresize(y2, size(y5));
% Now sum them
output = y2Larger + y5;
% Alternative method using interp1
x = linspace(1, length(y5), length(y2));
xi = 1:length(y5);
y2Larger = interp1(x, y2, xi)
% Now sum them
output = y2Larger + y5;

Ahmed A. Selman
Ahmed A. Selman 2013년 3월 27일
Use reshape
Y=function(X,m,n)
It works for any input matrix (X) with number of elements (m x n). The output is Y with m-rows by n-columns. The size of X and Y must be the same.

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by