Add two functions
This commit is contained in:
		
							
								
								
									
										15
									
								
								gravimeter/align.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								gravimeter/align.m
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
function [A] = align(V)
 | 
			
		||||
%A!ALIGN(V) returns a constat matrix A which is the real alignment of the
 | 
			
		||||
%INVERSE of the complex input matrix V
 | 
			
		||||
%from Mohit slides
 | 
			
		||||
 | 
			
		||||
    if (nargin ==0) || (nargin > 1)
 | 
			
		||||
        disp('usage: mat_inv_real = align(mat)')
 | 
			
		||||
        return
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    D = pinv(real(V'*V));
 | 
			
		||||
    A = D*real(V'*diag(exp(1i * angle(diag(V*D*V.'))/2)));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
end
 | 
			
		||||
							
								
								
									
										34
									
								
								gravimeter/pzmap_testCL.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								gravimeter/pzmap_testCL.m
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,34 @@
 | 
			
		||||
function [] = pzmap_testCL(system,H,gain,feedin,feedout)
 | 
			
		||||
% evaluate and plot the pole-zero map for the closed loop system for
 | 
			
		||||
% different values of the gain
 | 
			
		||||
 | 
			
		||||
    [~, n] = size(gain);
 | 
			
		||||
    [m1, n1, ~] = size(H);
 | 
			
		||||
    [~,n2] = size(feedin);
 | 
			
		||||
 | 
			
		||||
    figure
 | 
			
		||||
    for i = 1:n
 | 
			
		||||
        %     if n1 == n2
 | 
			
		||||
        system_CL = feedback(system,gain(i)*H,feedin,feedout);
 | 
			
		||||
 | 
			
		||||
        [P,Z] = pzmap(system_CL);
 | 
			
		||||
        plot(real(P(:)),imag(P(:)),'x',real(Z(:)),imag(Z(:)),'o');hold on
 | 
			
		||||
        xlabel('Real axis (s^{-1})');ylabel('Imaginary Axis (s^{-1})');
 | 
			
		||||
        %         clear P Z
 | 
			
		||||
        %     else
 | 
			
		||||
        %         system_CL = feedback(system,gain(i)*H(:,1+(i-1)*m1:m1+(i-1)*m1),feedin,feedout);
 | 
			
		||||
        %
 | 
			
		||||
        %         [P,Z] = pzmap(system_CL);
 | 
			
		||||
        %         plot(real(P(:)),imag(P(:)),'x',real(Z(:)),imag(Z(:)),'o');hold on
 | 
			
		||||
        %         xlabel('Real axis (s^{-1})');ylabel('Imaginary Axis (s^{-1})');
 | 
			
		||||
        %         clear P Z
 | 
			
		||||
        %     end
 | 
			
		||||
    end
 | 
			
		||||
    str = {strcat('gain = ' , num2str(gain(1)))};  % at the end of first loop, z being loop output
 | 
			
		||||
    str = [str , strcat('gain = ' , num2str(gain(1)))]; % after 2nd loop
 | 
			
		||||
    for i = 2:n
 | 
			
		||||
        str = [str , strcat('gain = ' , num2str(gain(i)))]; % after 2nd loop
 | 
			
		||||
        str = [str , strcat('gain = ' , num2str(gain(i)))]; % after 2nd loop
 | 
			
		||||
    end
 | 
			
		||||
    legend(str{:})
 | 
			
		||||
end
 | 
			
		||||
		Reference in New Issue
	
	Block a user