Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
37 views3 pages

Temp Code

This MATLAB function generates a gate pulse signal at a given frequency F. It defines 8 output variables (S1-S8) that represent the on/off states of 4 switches in each of 2 levels. The function divides each cycle into 12 intervals, sequentially setting the level (1-5) and corresponding switch states to produce the gate pulse waveform over one period T=1/F.

Uploaded by

Rahul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views3 pages

Temp Code

This MATLAB function generates a gate pulse signal at a given frequency F. It defines 8 output variables (S1-S8) that represent the on/off states of 4 switches in each of 2 levels. The function divides each cycle into 12 intervals, sequentially setting the level (1-5) and corresponding switch states to produce the gate pulse waveform over one period T=1/F.

Uploaded by

Rahul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

function [S1,S2,S3,S4,S5,S6,S7,S8] = GATEPULSE(F)

%#codegen

persistent level;

T=(1/F);

if level== 1

S1=1
S2=1
S3=0
S4=0
S5=1
S6=1
S7=0
S8=0

elseif level== 2

S1=1
S2=1
S3=0
S4=0
S5=1
S6=0
S7=1
S8=0

elseif level== 3

S1=1
S2=0
S3=1
S4=0
S5=1
S6=0
S7=1
S8=0

elseif level== 4

S1=0
S2=1
S3=0
S4=1
S5=1
S6=0
S7=1
S8=0

else level== 5

S1=0
S2=1
S3=0
S4=1
S5=0
S6=1
S7=0
S8=1

end

for n=0:(T/12):T

if 0 < n <= (T/12)


level= 3;

elseif (T/12) < n <= (T/6)


level= 2;

elseif (T/6) < n <= (T/3)


level=1;

elseif (T/3) < n <= (5*T/12)


level=2;

elseif (5*T/12) < n <= (7*T/12)


level=3;

elseif (7*T/12) < n <= (8*T/12)


level=4;

elseif (8*T/12) < n <= (5*T/6)


level=5;

elseif (5*T/6) < n <= (11*T/12)


level=4;

else (11*T/12) < n <= (T)


level=3;

end

You might also like