how to reverse,scale and shift an acquired signal?

i want a concise code to perform simple operations on an acquired signal which is in cvv format.

 Accepted Answer

% code
clc;
clear all;
close all;
s = xlsread('C:\Users\ADMIN\Desktop\DSO00001.csv');
x = s(:,1);
y = s(:,2);
x1 = 0;
y1 = 0;
c = 0;
disp('1)Time Scale:');
disp('2)Time Shift:');
disp('3)Time Reversal:');
disp('4)Scale,Shift and Reversal:');
while((c >=5 || c<=0))
c = input('Enter choice: ');
switch(c)
case 1
a = input('Enter Scaling factor: ');
x1 = x/a;
y1 = y;
case 2
b = input('Enter shifting factor: ');
x1 = (x-b);
y1 = y;
case 3
x1 = (-1)*x;
y1 = y;
case 4
a = input('Enter Scaling factor: ');
b = input('Enter shifting factor: ');
x1 = (-1)*(x-(b*a))/a;
y1 = y;
otherwise
disp('Invalid Input');
end
if(c>0 && c<5)
subplot(1,2,1)
plot(x,y)
xlabel('t')
ylabel('signal')
grid on
title('Original Signal:')
subplot(1,2,2)
plot(x1,y1)
xlabel('t')
ylabel('signal')
grid on
title('Resultant Signal:')
hold on;
end
end
%given below is the output for reversing%

More Answers (1)

Time reversal property for DFT of matlab code

Categories

Find more on Signal Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!