Program:
clc;
clear all;
a = input('Enter the amplitude = ');
f = input('Enter the frequency = ');
n = input('Enter the N value = ');
t = 0:0.1:n;
x1 = stem(-t/3);
x2 = sin(2*pi*f*t);
y = x1.*x2;
subplot(3,1,1);
stem(x1);
title('Impulse Signal');
ylabel('Amplitude ---->');
xlabel('n ---->');
grid on;
subplot(3,1,2)
plot(t,x2);
title('Sine Wave');
xlabel('Time ----->');
ylabel('Amplitude ----->');
grid on;
subplot(3,1,3)
stem(t,y);
title('Pulse Modulated Wave');
xlabel('Time ----->');
ylabel('Amplitude ----->');
grid on;
Output:
Enter the amplitude = 5
Enter the frequency = 1
Enter the N value = 2
Waveform:
clc;
clear all;
a = input('Enter the amplitude = ');
f = input('Enter the frequency = ');
n = input('Enter the N value = ');
t = 0:0.1:n;
x1 = stem(-t/3);
x2 = sin(2*pi*f*t);
y = x1.*x2;
subplot(3,1,1);
stem(x1);
title('Impulse Signal');
ylabel('Amplitude ---->');
xlabel('n ---->');
grid on;
subplot(3,1,2)
plot(t,x2);
title('Sine Wave');
xlabel('Time ----->');
ylabel('Amplitude ----->');
grid on;
subplot(3,1,3)
stem(t,y);
title('Pulse Modulated Wave');
xlabel('Time ----->');
ylabel('Amplitude ----->');
grid on;
Output:
Enter the amplitude = 5
Enter the frequency = 1
Enter the N value = 2
Waveform:
Hello ! I am making a model of VFD and running a 3 phase motor(designed on matlab using scripts file).
ReplyDeleteI have now pure D.C voltages and want to convert it to 3 phase voltage of my desired frequency . can anyone send me the code?? I have no idea how to do it.
I copied your code into matlab but its doesn't like the x1.*x2 part. I think you can't multiply a stem with a vector. Please fix thanks
ReplyDeleteIt does not work, the code has error
ReplyDeletenot executed like this
ReplyDelete