close all
clear all

Fcy = 40e6;
PolePairs = 5;
fMax = 20000;
NMax = 6000;

fMin = 5000;

MinP1TPER = hex2dec('400');


MinTransitionsPerElecCycles = fMax/(NMax*PolePairs/60)


RPMMin = fMin*60/(MinTransitionsPerElecCycles*PolePairs)


N = RPMMin:6000;

Freq = fMax*(N/NMax);

P1TPERValue =Fcy./(2*Freq);

figure
subplot(2,1,1)
plot(N,Freq)
xlabel('RPM');
title(['Switching Freq for ' num2str(MinTransitionsPerElecCycles) ' Transitions Per Elec Cycle']);
ylabel('Switching Freq (Hz)');
grid on;

subplot(2,1,2)

plot(N,P1TPERValue);
xlabel('RPM');
title(['P1TPER Value for ' num2str(MinTransitionsPerElecCycles) ' Transitions Per Elec Cycle']);
ylabel('P1TPER');
grid on;


