lecture-h-infinity/matlab/generateWeight.m

21 lines
910 B
Mathematica
Raw Permalink Normal View History

2020-11-30 17:44:13 +01:00
function [W] = generateWeight(args)
arguments
args.G0 (1,1) double {mustBeNumeric, mustBePositive} = 0.1
args.G1 (1,1) double {mustBeNumeric, mustBePositive} = 10
args.Gc (1,1) double {mustBeNumeric, mustBePositive} = 1
args.wc (1,1) double {mustBeNumeric, mustBePositive} = 2*pi
args.n (1,1) double {mustBeInteger, mustBePositive} = 1
end
if (args.Gc <= args.G0 && args.Gc <= args.G1) || (args.Gc >= args.G0 && args.Gc >= args.G1)
eid = 'value:range';
msg = 'Gc must be between G0 and G1';
throwAsCaller(MException(eid,msg))
end
s = zpk('s');
W = (((1/args.wc)*sqrt((1-(args.G0/args.Gc)^(2/args.n))/(1-(args.Gc/args.G1)^(2/args.n)))*s + (args.G0/args.Gc)^(1/args.n))/((1/args.G1)^(1/args.n)*(1/args.wc)*sqrt((1-(args.G0/args.Gc)^(2/args.n))/(1-(args.Gc/args.G1)^(2/args.n)))*s + (1/args.Gc)^(1/args.n)))^args.n;
end