35 lines
		
	
	
		
			887 B
		
	
	
	
		
			Matlab
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			887 B
		
	
	
	
		
			Matlab
		
	
	
	
	
	
| function [H1, H2] = generateCF(W1, W2, args)
 | |
| % createWeight -
 | |
| %
 | |
| % Syntax: [H1, H2] = generateCF(W1, W2, args)
 | |
| %
 | |
| % Inputs:
 | |
| %    - W1 - Weighting Function for H1
 | |
| %    - W2 - Weighting Function for H2
 | |
| %    - args:
 | |
| %      - method  - H-Infinity solver ('lmi' or 'ric')
 | |
| %      - display - Display synthesis results ('on' or 'off')
 | |
| %
 | |
| % Outputs:
 | |
| %    - H1 - Generated H1 Filter
 | |
| %    - H2 - Generated H2 Filter
 | |
| 
 | |
| %% Argument validation
 | |
| arguments
 | |
|     W1
 | |
|     W2
 | |
|     args.method  char {mustBeMember(args.method,{'lmi', 'ric'})} = 'ric'
 | |
|     args.display char {mustBeMember(args.display,{'on', 'off'})} = 'on'
 | |
| end
 | |
| 
 | |
| %% The generalized plant is defined
 | |
| P = [W1 -W1;
 | |
|      0   W2;
 | |
|      1   0];
 | |
| 
 | |
| %% The standard H-infinity synthesis is performed
 | |
| [H2, ~, gamma, ~] = hinfsyn(P, 1, 1,'TOLGAM', 0.001, 'METHOD', args.method, 'DISPLAY', args.display);
 | |
| 
 | |
| %% H1 is defined as the complementary of H2
 | |
| H1 = 1 - H2;
 |