Sunday 4 August 2013

Matlab code for three phase voltage source including all labels and legends

% Program to develop user defined Three Phase voltage source
clc;
clear all;

Vm = input('Enter Peak Magnitude Required in volts: ');
f = input('Enter Supply frequency in Hz: ');
w = 2 * pi * f; % Angular frequency in rad/sec
time = input('Enter time in sec upto which output is required: ');
t = 0:10e-6:time;
First_phase = Vm * sin(w * t);
Second_phase = Vm * sin(w * t + 120);
Third_phase = Vm * sin(w * t - 120);
subplot(3,1,1),plot(t,First_phase,'r-')
axis([0 time -Vm Vm])
title('\bfFirst Phase Voltage');
xlabel('\bfTime in sec');
ylabel('\bfAmplitude in volts');
legend('R-Phase 1')
subplot(3,1,2),plot(t,Second_phase,'y-')
axis([0 time -Vm Vm])
xlabel('\bfTime in sec');
ylabel('\bfAmplitude in volts');
title('\bfSecond Phase voltage');
legend('Y-Phase 2')
subplot(3,1,3),plot(t,Third_phase,'b-')
axis([0 time -Vm Vm])
xlabel('\bfTime in sec');
ylabel('\bfAmplitude in volts');
title('\bfThird Phase Voltage ');
legend('B-Phase 3')

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Enter Peak Magnitude Required in volts: 340
%Enter Supply frequency in Hz: 50
%Enter time in sec upto which output is required: 0.06
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%% End of the program %%%%%%%%%%%%%%%%%%%%%%%%

No comments:

Post a Comment