%%% sPS in M and h dependent
echo off;clear;clc;close all
vt = [1 -1 -1 1 -1 1 1 1 1];vt = vt'; %%% Mary message signal
vt = [3 -1 -1 1 -1 1 -3 1 1];vt = vt';
%sim('GModulatortest');vt = stBCPM;
%%% Setting parameters for CPMFXC_Exp1_test model file 
ST = '100000';ST1 = '0.9';set_param('CPMFXC_Exp1_test','StopTime',ST1);SD = '12';SD = '20';
set_param('sGen','StopTime',ST);
tBL = '4';tBLnum = str2num(tBL);
M = '16';h = '2/3';gtshape = 'Rectangular';L = '3';preH = '[1 1]';sPS = '4';gtshape = 'Raised Cosine';
set_param('sGen/Random Integer Generator','mul',M,'seed',SD);
set_param('sGen/Unipolar to Bipolar Converter','M',M);
sim('sGen');vt = stBCPM;%vt = stBCPM(1:11);
set_param('CPMFXC_Exp1_test/CPM Modulator Baseband','Mnum',M,'modIdx',h,'pulseShape',gtshape,'pulseLength',L,'preHistory',preH,'samplesPerSymbol',sPS);
set_param('CPMFXC_Exp1_test/M-PSK Modulator Baseband','M',M);set_param('CPMFXC_Exp1_test/M-PSK Demodulator Baseband','M',M);
set_param('CPMFXC_Exp1_test/CPM Demodulator Baseband','Mnum',M,'modIdx',h,'pulseShape',gtshape,'pulseLength',L,'preHistory', ....
    preH,'samplesPerSymbol',sPS,'traceBack',tBL);
sim('CPMFXC_Exp1_test');%st

% vt(1:end - tBLnum)'
% vt1(tBLnum + 1:end)'
symerr(vt(1:end - tBLnum),vt1(tBLnum + 1:end))
symerr(stMaryCPM,stDPSK)