how to create fourier transform and laplace from basic signals?
Mostrar comentarios más antiguos
fprintf('Please choose any type of signal below.\n1. Impulse\n2. Step function\n3. DC Source\n4. Signum function\n5. Rising exponent function\n6. Cosine function\n7. Sine function\n8. Square function\n9. Triangular function\n10. Symmetrical decaying exponent function')
s=input('\nSignal number: ');
a=input('Please choose any of these signal transformation\n1. Time scale\n2. Time shift\n3. Time inversion\n4. Amplitude scale\n5. Amplitude Shift\n6. Amplitude inversion\n');
switch (s)
case 7
A=input('Enter Amplitude:');
F= input('Enter frequency:');
t=0:0.01:1;
y = A*sin(2*pi*F*t);
figtitle = 'Sine Wave';
switch (a)
case 1 %time scale
z= input('Enter time scale value:');
tmod=z\t;
ymod=y;
case 2 %time shifting
z= input('Enter time shifting value:');
tmod=t-z;
ymod=y;
case 3 %time inversion
tmod=-t;
ymod=y;
case 4 %amplitude scale
z=input('Enter amplitude scale value:');
tmod=t;
ymod=z*y;
case 5 %amplitude shift
z=input('Enter amplitude shift value:');
tmod=t;
ymod=y-z;
case 6 %amplitude inversion
tmod=t;
ymod=-y;
end
plot(t,y,'b')
hold on
plot(tmod,ymod,'k')
hold off
title(figtitle)
xlabel('Time')
ylabel('Amplitude')
grid on
% adjust limits to create padding
xlim(xlim + [-1 1]*0.2)
ylim(ylim + [-1 1]*1.5)
%Fourier Transform
%Laplace Transform
case 8
A=input('Enter Amplitude:');
f= input('Enter frequency:');
t =0:0.01:1;
sqwv = A*sign(sin(2*pi*t*f));
figtitle = 'Square Wave';
switch (a)
case 1 %time scale
z=input('Enter time scale value:');
tmod= z\t;
ymod=sqwv;
case 2 %time shifting
z=input('Enter time shifting value:');
tmod= t-z;
ymod=sqwv;
case 3 %time inversion
tmod= -t;
ymod=sqwv;
case 4 %amplitude scale
z=input('Enter scale value:');
tmod= t;
ymod=z*sqwv;
case 5 %amplitude shift
z=input('Enter amplitude shift value:');
tmod= t;
ymod=sqwv+z;
case 6 %amplitude inversion
tmod= t;
ymod=-sqwv;
end
plot(t,sqwv,'b')
hold on
plot(tmod,ymod,'k')
hold off
title(figtitle)
xlabel('Time')
ylabel('Amplitude')
grid on
% adjust limits to create padding
xlim(xlim + [-1 1]*0.3)
ylim(ylim + [-1 1]*1.5)
%Fourier Transform
%Laplace Transform
end
1 comentario
Star Strider
el 22 de En. de 2022
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Discrete Fourier and Cosine Transforms en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
