matlab: toolboxes, technical calculations. numeric integration (1) evaluating integral: computing a...

12
MATLAB: toolboxes, technical calculations

Upload: eliseo-gillam

Post on 14-Dec-2015

240 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: MATLAB: toolboxes, technical calculations. Numeric integration (1) Evaluating integral: computing a surface below a curve

MATLAB:toolboxes, technical calculations

Page 2: MATLAB: toolboxes, technical calculations. Numeric integration (1) Evaluating integral: computing a surface below a curve

Numeric integration (1)• Evaluating integral:

computing a surface below a curve

Page 3: MATLAB: toolboxes, technical calculations. Numeric integration (1) Evaluating integral: computing a surface below a curve

function y = sinc( x, a)

% the function has to return a vector of functional values y% for the vector of input numbers x

y = log( x+a) .* sin( x)./( x+0.1);

1. Creating m-file, which containsthe integrated function

Numeric integration (2)

Page 4: MATLAB: toolboxes, technical calculations. Numeric integration (1) Evaluating integral: computing a surface below a curve

function out = integ( low, up)

out = quadl( 'sinc', low, up, 1e-5, [], 0.5);

2. Performing integration by standard m-functionquadl

Numeric integration (3)

Page 5: MATLAB: toolboxes, technical calculations. Numeric integration (1) Evaluating integral: computing a surface below a curve

syms x a l u

y = int( log( x+a) .* sin( x)./( x+0.1), x, l, u)y = simple( y)

pretty ( y)

Symbolic integration

• Symbolic Math Toolbox:m-function int

Page 6: MATLAB: toolboxes, technical calculations. Numeric integration (1) Evaluating integral: computing a surface below a curve

h = 0.01; % sampling step

y = sinc( 0:h:1, 0.5);

y1 = diff( y) / h;

y2a = diff( y1) / h;

y2b = diff( y, 2) / h^2;

Numeric differencing (1)

• Differencing performed by standardm-function diff

2

xyxy

dx

dy

x

y(x)

Page 7: MATLAB: toolboxes, technical calculations. Numeric integration (1) Evaluating integral: computing a surface below a curve

Numeric differencing (2)

Page 8: MATLAB: toolboxes, technical calculations. Numeric integration (1) Evaluating integral: computing a surface below a curve

syms x a

y1 = diff( log( x+a) .* sin( x)./( x+0.1), 'x', 1)y1 = simple( y1)pretty ( y1)

y2 = diff( log( x+a) .* sin( x)./( x+0.1), 'x', 2)y2 = simple( y2)pretty( y2)

Symbolic differencing

• Symbolic Math Toolbox:m-function diff

Page 9: MATLAB: toolboxes, technical calculations. Numeric integration (1) Evaluating integral: computing a surface below a curve

Optimization Toolbox (1)

• Searching for such A, B, h, r so thatthe input impedance is Z = (200 + j 0) on the frequency f = 30 GHz

Page 10: MATLAB: toolboxes, technical calculations. Numeric integration (1) Evaluating integral: computing a surface below a curve

Optimization Toolbox (2)

1. Formulating fitness function:how does the optimized structure fit demands

22 ,,,,,,,,, hBAXXhBARRhBAF rdrdr

hBAF rhBA

,,,min,,,

Page 11: MATLAB: toolboxes, technical calculations. Numeric integration (1) Evaluating integral: computing a surface below a curve

Optimization Toolbox (3)

2. Creating m-file,which contains the fitness function

function out = mstrip( x)

global net Tmax Rd Xd

Z = Tmax * sim( net, x); % input impedance of the dipoleout = ((Rd-Z(1,:)).*(Rd-Z(1,:)) + (Xd-Z(2,:)).*(Xd-Z(2,:)))';

Page 12: MATLAB: toolboxes, technical calculations. Numeric integration (1) Evaluating integral: computing a surface below a curve

Optimization Toolbox (4)

3. Performing optimization by OptimizationToolbox m-function fminunc

function x = toolbox

global net Tmax Rd Xd

load dip_616; % loading the antenna model

Rd = 200; % desired value of input resistanceXd = 0; % desired value of input reactance

x0 = [ 5.00; 0.05; 2.00; 1.25]; % A, B, eps, h

x = fminunc('mstrip', x0)