필터 지우기
필터 지우기

how to write a program to plot the signal {1, 2, 3, 4, 5} and also how to Represent this sequence x(n) = {0, 1, 2, 3, 4, 5}. in MATLAB.

조회 수: 4 (최근 30일)
please can someone offer a help to this.Thank you as you volunteer.

답변 (1개)

KSSV
KSSV 2017년 8월 21일
What ever come sin flower braces ({}) is a cell in MATLAB. A matrix comes in square braces ([]). You can check the class of the variable using class. It is better to have a matrix for calculations and plotting. YOu can plot your signal as below:
mysignal = {1 2 3 4 5} ; % it is a cell (check with _class(mysignal)_)
mysignal = cell2mat(mysignal) % convert to matrix using _Cell2mat_
plot(mysignal) % plot using _plot_
Coming about the next question; regaridng sequence. If you have all same vectors, save them in a matrix. Like below:
X = zeros(5,5) ;
for i = 1:5
X(i,:) = rand(1,5) ;
end
If your sequence is having different sized vectors, save them into cell. Like below.
X = cell(3,1) ;
X{1} = rand(!,5) ;
X{2} = rand(1,7) ;
X{3} = rand(5,1) ;
MATLAB is easy with rich documentation. REad about matrix indexing:

카테고리

Help CenterFile Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by