Shifting signals to the right
조회 수: 11 (최근 30일)
이전 댓글 표시
Hi, I have a matrix, M which is 10*2000 double (10 rows of signals and each signal contains 2000 variables). I want to shift each of the signal in this matrix to the right by say 1. I have a code (below) that can shift a single signal (that is if M contains a single signal, 1*2000). How do I modify this to shift each signal in M at the same time?
The code code for shifting a single signal is:
p = M;
Shift = 1;
Shifted_M = circshift(p,Shift);
In summary, I want a code that can shift each independent row signal in a matrix and output the shifted matrix as Shifted_M. After that I would like to plot this shifted matrix with the original data to visualize it.
Thanks
댓글 수: 1
Tanveer ul haq
2020년 6월 18일
% consider your matrix is M then:
M=[1 2 3; 4 5 6; 7 8 9];
Shift = 1;
Shifted_M = circshift(M',Shift);
rotated_matrix = Shifted_M'
채택된 답변
추가 답변 (1개)
Rutuja
2024년 12월 4일
clc;
clear;
close all;
Fs = 1000;
t = -0.02:1/Fs:0.02;
fc = 100;
modulation_index = 1;
M=[1 2 3; 4 5 6; 7 8 9];
Shift = 1;
Shifted_M = circshift(M',Shift);
rotated_matrix = Shifted_M'
m_t = [t ./ (1 + t.^2)];
c_t = cos(2 * pi * fc * t);
am_signal = (1 + modulation_index * m_t) .* c_t;
subplot(3, 1, 1);
plot(t, m_t);
title('Message Signal');
xlabel('Time (s)');
ylabel('Amplitude');
subplot(3, 1, 2);
plot(t, c_t);
title('Carrier Signal');
xlabel('Time (s)');
ylabel('Amplitude');
subplot(3, 1, 3);
plot(t, am_signal);
title('Amplitude Modulated Signal (100% Modulation Index)');
xlabel('Time (s)');
ylabel('Amplitude');
shift the signal for 5 units
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
