matlab code for pwm inverter m file
#1

SDSDSDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
Reply
#2
matlab code for pwm inverter m file

PWM (Pulse Width Modulation) can be easily generated in MATLAB using simple MATLAB functions. We have already discussed about PWM generator circuit using 741 Op-amp in previous posts. In PWM, width of the pulses are varied according to the amplitude of AF message signal. PWM is basically an analog pulse modulation technique. It does modulation of the duty cycle of the pulse.
In addition to its use in communication systems, PWM is also used in voltage regulators such as Switched Mode Power Supplies (SMPS) to control the power delivered to the load. PWM can be generated using a comparator to which the modulating signal and a reference ramp (sawtooth) waveform are fed.The code for PWM simulation in MATLAB is shown below. The use of particular line of MATLAB code is also given as comments (%Comment field). The given MATLAB program accepts two input frequencies from the user.

clc;
clear all;
close all;
F2=input(‘Message frequency=’);
F1=input(‘Carrier Sawtooth frequency=’);
A=5;
t=0:0.001:1;
c=A.*sawtooth(2*pi*F1*t);%Carrier sawtooth
subplot(3,1,1);
plot(t,c);
xlabel(‘time’);
ylabel(‘Amplitude’);
title(‘Carrier sawtooth wave’);
grid on;
m=0.75*A.*sin(2*pi*F2*t);%Message amplitude must be less than Sawtooth
subplot(3,1,2);
plot(t,m);
xlabel(‘Time’);
ylabel(‘Amplitude’);
title(‘Message Signal’);
grid on;
n=length©;%Length of carrier sawtooth is stored to ‘n’
for i=1:n%Comparing Message and Sawtooth amplitudes
if (m(i)>=c(i))
pwm(i)=1;
else
pwm(i)=0;
end
end
subplot(3,1,3);
plot(t,pwm);
xlabel(‘Time’);
ylabel(‘Amplitude’);
title(‘plot of PWM’);
axis([0 1 0 2]);%X-Axis varies from 0 to 1 & Y-Axis from 0 to 2
grid on;

% Author: Rashmil Dahanayake
% 3 Phase Inverter, Sinusoidal PWM
% Simulated with LC filter + RL load
% 31/12/2013
% Ref Chapter 8-4-1 Power electronics: converters, applications, and design. N. Mohan and T. M. Undeland,


clc;
clear all;

% Simulation settings
st=0.1; % simulation period in seconds
Ts=1e-6; % sampling peiod in seconds
t=0:TsConfusedt; % define time range

% Triangular carrier wave
f= 3e3; % switching frequency in Hz
ref= 2/pi*asin(sin(2*pi*t*f)); % carrier signal

Vdc=400; %input DC voltage
m=1; % modulation index


% control signal
fo=50; %output voltage frequncy in Hz -- 120^ phase shifted sinusoids
Cont=m*sin([2*pi*fo*t; 2*pi*fo*t+2*pi/3 ; 2*pi*fo*t+4*pi/3 ]);

% Inverter Circuit derive pole voltages
V_A0=(Cont(1,Smile>=ref)*Vdc/2 + (Cont(1,Smile<ref)*-Vdc/2 ;
V_B0=(Cont(2,Smile>=ref)*Vdc/2 + (Cont(2,Smile<ref)*-Vdc/2 ;
V_C0=(Cont(3,Smile>=ref)*Vdc/2 + (Cont(3,Smile<ref)*-Vdc/2 ;

% Line to Line voltages
V_AB=V_A0 - V_B0;
V_BC=V_B0 - V_C0;
V_CA=V_C0 - V_A0;

% Load Neutral voltage
V_Nn=(V_A0+V_B0+V_C0)/3;

% Phase Voltages
V_An=(V_AB-V_CA)/3; % same as V_An=2/3 *V_A0 - 1/3 *(V_B0+V_C0)
V_Bn=2/3*V_B0 + 1/3*(V_A0+V_C0);
V_Cn=(V_CA-V_BC)/3;

%Load Parameters
Lload = 2e-3; %Load inductance
Rload= 5; % Load resistance

%Filter Parameters
Lf= 10e-3; % Inductance for output filter
Cf= 20e-6; % Capacitance for output filter

% state space equations for LC filter
A=[zeros(3,3) eye(3)/(3*Cf) -eye(3)/(3*Cf); -eye(3)/Lf zeros(3,3) zeros(3,3);
eye(3,3)/Lload zeros(3,3) -eye(3)*Rload/Lload]; % systemmatrix
B=[zeros(3,3); eye(3)/Lf; zeros(3,3)]; % coefficient for thecontrol variable u
C=eye(9); % coefficient for the output y
D=zeros(9,3); % coefficient for the output y
Ks = 1/3*[-1 0 1; 1 -1 0; 0 1 -1]; % Conversion matrix to transform [iiAB iiBC iiCA] to [iiA iiB iiC]

%Transfer function for inverter output stage
sys= ss(A,B,C,D); % state space model of a LC filter + RL load
U=[V_AB;V_BC;V_CA]; % input for the system (sys)

% calculating filtered output
% Y=H(1,1) * V_AB; tf method

[y1,t1]=lsim(sys,U,t); % solving state space equations
% <--Columns 1 to 9 of Y1 represent
% VAB,VBC,VCA,ILf_AB,ILf_BC,ILf_CA,ILload_AB,ILload_BC,ILload_CA-->

% Plots
figure('Position',[175+100 70 760 555],'name','Switching'); % raw output from inverter
subplot(3,1,1); % reference signals
plot(t,ref,'g',t,Cont);title('Switching ref & carrier signal');
axis([st/5 st/5+.01 -1.1 1.1]);grid on;

subplot(3,1,2); %line-to-line
plot(t,V_AB,'b');title('Line to Line inverter output Voltages');
axis([st/5 st/5+.01 -Vdc Vdc]);grid on;

subplot(3,1,3); % Phase voltages
plot(t,V_Bn,'r');title('Phase Voltages');
axis([st/5 st/5+.01 -2/3*Vdc 2/3*Vdc]); grid on;

figure('Position',[175+3*100 70 760 555],'name','Filtered output'); % inverter output connected to LC filter and RL load
plot(t1,y1(:,1));grid on; title('Line to line load voltage');
Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Popular Searches: inverter topic file seminar, sample c code for pwm in lpc1768, pwm code for lpc2148, pdf file of inverter, simulation of 3 phase pwm inverter with using matlab viva questions, inverter pdf file, pwm gate driver matlab,

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Possibly Related Threads...
Thread Author Replies Views Last Post
  how to calculate distance in heed protocol by using matlab 1 1,887 15-06-2018, 03:54 PM
Last Post: Guest
  matlab code for incremental conductance mppt 1 1,426 02-05-2018, 02:28 PM
Last Post: eksi
  anomaly detection code in matlab 3 2,094 23-04-2018, 12:04 AM
Last Post: Guest
  matlab code for liver tumor segmentation 2 1,585 01-04-2018, 06:29 PM
Last Post: [email protected]
  matlab code for vehicle tracking using unscented kalman filter 3 16,876 26-03-2018, 08:57 PM
Last Post: fodayj
  matlab code for facial expression recognition using frequency domain 1 2,683 19-02-2018, 06:03 PM
Last Post: Guest
  solar water purification by using thermal method pdf file 2 13,167 12-02-2018, 03:44 PM
Last Post: dhanabhagya
  matlab code shadow detection and removal in colour images using matlab 2 2,262 12-01-2018, 01:24 PM
Last Post: dhanabhagya
  simulink matlab model upqc mdl 3 6,777 18-12-2017, 09:08 AM
Last Post: jaseela123d
  matlab code for speed breaker detection 1 1,295 27-10-2017, 10:22 AM
Last Post: Guest

Forum Jump: