ToEstSNR = np.abs(ToEstNom / ToEstUnc)**2 SoEstSNR = np.abs(SoEstNom / SoEstUnc)**2 LoEstSNR = np.abs(LoEstNom / LoEstUnc)**2 #%% Nyquist Plot - Output Complimentary Sensitivity Function ToLinUncMag = np.abs(ToLinUnc) ToEstUncMag = np.abs(ToEstUnc) numOut, numIn = ToLinNom.shape[0:-1] ioArray = np.array(np.meshgrid(np.arange(numOut), np.arange(numIn))).T.reshape(-1, 2) if False: for iPlot, [iOut, iIn] in enumerate(ioArray): fig = 10 + iPlot fig = FreqTrans.PlotNyquist(ToLinNom[iOut, iIn], ToLinUncMag[iOut, iIn], fig = fig, fillType = 'fill', color = 'k', label = 'Linear') fig = FreqTrans.PlotNyquist(ToEstNom[iOut, iIn], ToEstUncMag[iOut, iIn], fig = fig, fillType = 'circle', marker='.', color = 'b', linestyle='None', label = 'Estimate (MIMO)') fig = FreqTrans.PlotNyquist(ToEstNom[iOut, iIn, sigIndx[iIn]], ToEstUncMag[iOut, iIn, sigIndx[iIn]], fig = fig, fillType = 'circle', marker='.', color = 'g', linestyle='None', label = 'Estimate (SIMO)') fig = FreqTrans.PlotNyquist(np.array([-1+0j]), np.array([0.4]), fig = fig, fillType = 'circle', marker='+', color = 'r', linestyle='None') ax = fig.get_axes() # handles, labels = ax[0].get_legend_handles_labels() # handles = [handles[0], handles[3], handles[1], handles[4], handles[2], handles[5]] # labels = [labels[0], labels[3], labels[1], labels[4], labels[2], labels[5]] # ax[0].legend(handles, labels) fig.suptitle('$T_o$ : ' + '$r_{Exc}$[' + str(iIn) + '] to ' + '$z$[' + str(iOut) + ']') #%% Bode Plot - Output Complimentary Sensitivity Function # Linear Model Gain and Phase
#%% Nyquist Plots - Ta TaLinUncMag = abs(TaLinUnc) TaEstUncMag = abs(TaEstUnc) if False: for iPlot, io in enumerate(ioArray): iOut, iIn = io outName = outPlot[iOut] inName = inPlot[iIn] fig = 60 + iPlot fig = FreqTrans.PlotNyquist(TaLinNom[iOut, iIn], TaLinUncMag[iOut, iIn], fig=fig, fillType='fill', color='k', label='Linear') fig = FreqTrans.PlotNyquist(TaEstNom[iOut, iIn], TaEstUncMag[iOut, iIn], fig=fig, color='b', label='Estimate (MIMO)') fig = FreqTrans.PlotNyquist(TaEstNom[iOut, iIn, sigIndx[iIn]], TaEstUncMag[iOut, iIn, sigIndx[iIn]], fig=fig, color='g', label='Estimate (SIMO)') fig = FreqTrans.PlotNyquist(np.asarray([-1 + 0j]), TUnc=np.asarray([0.4 + 0.4j]),
fig.suptitle(oDataSegs[iSeg]['Desc'] + ': Spectrogram - ' + sigOutList[iSgnl]) #%% Nyquist Plots inPlot = sigInList # Elements of sigInList outPlot = sigOutList # Elements of sigOutList if False: for iIn, inName in enumerate(inPlot): for iOut, outName in enumerate(outPlot): fig = None for iSeg in range(0, len(oDataSegs)): fig = FreqTrans.PlotNyquist(T[iSeg][iOut, iIn], TUnc[iSeg][iOut, iIn], fig=fig, fmt='*', label=oDataSegs[iSeg]['Desc']) fig.suptitle(inName + ' to ' + outName, size=20) ax = fig.get_axes() ax[0].set_xlim(-3, 1) ax[0].set_ylim(-2, 2) #%% Bode Plots if True: for iIn, inName in enumerate(inPlot): for iOut, outName in enumerate(outPlot):
if False: FreqTrans.PrintPrettyFig(fig, 'OpenMimoBode' + str(iOut+1) + str(iIn+1) + '.pgf') #%% Nyquist Plot TLinUnc = np.abs(TLinUnc) if True: numOut, numIn = TLinNom.shape[0:-1] ioArray = np.array(np.meshgrid(np.arange(numOut), np.arange(numIn))).T.reshape(-1, 2) for io in ioArray: [iOut, iIn] = io fig = None fig = FreqTrans.PlotNyquist(TLinNom[iOut, iIn], TLinUnc[iOut, iIn], fig = fig, fillType = 'fill', color = 'k', label = 'Linear' + ' [$u_' + str(iIn+1) + '$ to ' + '$z_' + str(iOut+1) + '$]') fig = FreqTrans.PlotNyquist(TEstNom[iOut, iIn], TEstUnc[iOut, iIn], fig = fig, fillType = 'circle', marker='.', color = 'r', linestyle='None', label = 'Estimate' + ' [$u_' + str(iIn+1) + '$ to ' + '$z_' + str(iOut+1) + '$]') # fig = FreqTrans.PlotNyquist(TEstNom[iOut, iIn, sigIndx[iIn]], TEstUnc[iOut, iIn, sigIndx[iIn]], fig = fig, fillType = 'circle', marker='.', color = 'b', linestyle='None', label = 'Estimate (SIMO)') fig = FreqTrans.PlotNyquist(np.array([-1+0j]), fig = fig, fillType = 'circle', marker='+', color = 'r', linestyle='None') # fig = FreqTrans.PlotNyquist(np.array([-1+0j]), np.array([0.4]), fig = fig, fillType = 'circle', marker='+', color = 'r', linestyle='None') for iSamp in range(nSamp): fig = FreqTrans.PlotNyquist(TEstSamp[iOut, iIn, :, iSamp], fig = fig, fillType = 'circle', marker='.', color = 'gray', linestyle='None') ax = fig.get_axes() handles, labels = ax[0].get_legend_handles_labels() handles = [(handles[0], handles[2]), handles[1]] labels = [labels[0], labels[1]] ax[0].legend(handles, labels) # fig.set_size_inches([6.4,4.8])
TiLinUncMag = np.abs(TiLinUnc) TiEstUncMag = np.abs(TiEstUnc) if False: numOut, numIn = TiLinNom.shape[0:-1] ioArray = np.array(np.meshgrid(np.arange(numOut), np.arange(numIn))).T.reshape(-1, 2) for iPlot, io in enumerate(ioArray): [iOut, iIn] = io fig = 10 + iPlot fig = FreqTrans.PlotNyquist(TiLinNom[iOut, iIn], TiLinUncMag[iOut, iIn], fig=fig, fillType='fill', color='k', label='Linear') fig = FreqTrans.PlotNyquist(TiEstNom[iOut, iIn], TiEstUncMag[iOut, iIn], fig=fig, fillType='circle', marker='.', color='b', linestyle='None', label='Estimate (MIMO)') fig = FreqTrans.PlotNyquist(TiEstNom[iOut, iIn, sigIndx[iIn]], TiEstUncMag[iOut, iIn, sigIndx[iIn]], fig=fig, fillType='circle', marker='.',
fig.suptitle(inName + ' to ' + outName, size=20) ax = fig.get_axes() ax[0].set_ylim(0, 2) #%% Nyquist Plots if False: #%% for iOut, outName in enumerate(outPlot): for iIn, inName in enumerate(inPlot): fig = None for iSeg in range(0, len(oDataSegs)): fig = FreqTrans.PlotNyquist(T[iSeg][iOut, iIn], TUnc[iSeg][iOut, iIn], fig=fig, fmt=rtsmSegList[iSeg]['fmt'] + '*', label=oDataSegs[iSeg]['Desc']) fig = FreqTrans.PlotNyquist(np.asarray([-1 + 0j]), TUnc=np.asarray([0.4 + 0.4j]), fig=fig, fmt='*r', label='Critical Region') fig.suptitle(inName + ' to ' + outName, size=20) ax = fig.get_axes() ax[0].set_xlim(-3, 1) ax[0].set_ylim(-2, 2) #%% Bode Plots
fmt='--r', fig=fig, label='Critical Limit') ax = fig.get_axes() ax[0].set_xlim(0, 10) ax[0].set_ylim(0, 2) fig.suptitle(inName + ' to ' + outName, size=20) #%% Nyquist Plots if False: for iOut, outName in enumerate(outPlot): for iIn, inName in enumerate(inPlot): fig = 60 + 3 * iOut + iIn fig = FreqTrans.PlotNyquist(TxyLin[iOut, iIn], fig=fig, fmt='k', label='Linear') fig = FreqTrans.PlotNyquist(T[iOut, iIn, sigIndx[iIn]], fig=fig, fmt='bo', label='Excitation') fig = FreqTrans.PlotNyquist(T[iOut, iIn], fig=fig, fmt='g.:', label='MIMO') fig = FreqTrans.PlotNyquist(np.asarray([-1 + 0j]), TUnc=np.asarray([0.4 + 0.4j]), fig=fig, fmt='r+', label='Critical Region')
label='Critical') fig.suptitle(inPlot[iIn] + ' to ' + outPlot[iOut]) ax = fig.get_axes() ax[0].set_ylim(0, 2) #%% Nyquist Plots if False: for iPlot, [iOut, iIn] in enumerate(ioArray): fig = 20 + iPlot for iSeg in range(0, len(oDataSegs)): Tnom = LaEstNomList[iSeg][iOut, iIn] Tunc = np.abs(LaEstUncList[iSeg][iOut, iIn]) fig = FreqTrans.PlotNyquist(Tnom, Tunc, fig=fig, color=rtsmSegList[iSeg]['color'], marker='.', label=oDataSegs[iSeg]['Desc']) fig = FreqTrans.PlotNyquist(np.asarray([-1 + 0j]), TUnc=np.asarray([0.4 + 0.4j]), fig=fig, color='r', marker='+', label='Critical Region') fig.suptitle(inPlot[iIn] + ' to ' + outPlot[iOut]) ax = fig.get_axes() ax[0].set_xlim(-3, 1) ax[0].set_ylim(-2, 2)
color='r', linestyle='--') fig.suptitle(inName + ' to ' + outName, size=20) ax = fig.get_axes() # ax[0].set_ylim(0, 2) #%% Nyquist Plots if False: for iOut, outName in enumerate(outPlot): for iIn, inName in enumerate(inPlot): fig = None for iSeg in range(0, len(oDataSegs)): fig = FreqTrans.PlotNyquist(LiEstNomList[iSeg][iOut, iIn], fig=fig, color=rtsmSegList[iSeg]['color'], label=oDataSegs[iSeg]['Desc']) fig = FreqTrans.PlotNyquist(np.asarray([-1 + 0j]), TUnc=np.asarray([0.4 + 0.4j]), fig=fig, fmt='*r', label='Critical Region') fig.suptitle(inName + ' to ' + outName, size=20) ax = fig.get_axes() ax[0].set_xlim(-3, 1) ax[0].set_ylim(-2, 2) #%% Bode Plots if False: