## Finding variables that give a specific response.

## Finding variables that give a specific response.

(OP)

I have the following code:

clc

clear all

d1=1.6256;

d2=0.77;

d3=0.815;

b=11;

m=967.44;

Ig=9759.19;

V=73.05555;

rho=1.225;

dCL=10;

a11= (1/m)*(k1+k2);

a12= (1/m)*((k1*d3)-(d3*(k1-k2))-(0.5*dCL*rho*(V^2)*d1*b));

a21= (1/Ig)*(d3*(k2-k1));

a22= (1/Ig)*(d3*(k1+k2)-(0.5*dCL*rho*(V^2)*d1*b)*(d1-d3)-d3);

A1=[0,1,0,0;-a11,0,-a12,0;0,0,0,1;-a21,0,-a22,0];

eig(A1);

A=((a11+a22)/2)

B=((a11*a22)-(a12*a21))

I am trying to find the values of k1 and k2 (between 0 and 7e6) that give the results of B>A^2. There is likely to be multiple values so if I could plot them in to a contour plot of k1 vs k2 then it would help.

Can somebody suggest how this would be possible?

clc

clear all

d1=1.6256;

d2=0.77;

d3=0.815;

b=11;

m=967.44;

Ig=9759.19;

V=73.05555;

rho=1.225;

dCL=10;

a11= (1/m)*(k1+k2);

a12= (1/m)*((k1*d3)-(d3*(k1-k2))-(0.5*dCL*rho*(V^2)*d1*b));

a21= (1/Ig)*(d3*(k2-k1));

a22= (1/Ig)*(d3*(k1+k2)-(0.5*dCL*rho*(V^2)*d1*b)*(d1-d3)-d3);

A1=[0,1,0,0;-a11,0,-a12,0;0,0,0,1;-a21,0,-a22,0];

eig(A1);

A=((a11+a22)/2)

B=((a11*a22)-(a12*a21))

I am trying to find the values of k1 and k2 (between 0 and 7e6) that give the results of B>A^2. There is likely to be multiple values so if I could plot them in to a contour plot of k1 vs k2 then it would help.

Can somebody suggest how this would be possible?

## RE: Finding variables that give a specific response.

Cheers

Greg Locock

New here? Try reading these, they might help FAQ731-376: Eng-Tips.com Forum Policies http://eng-tips.com/market.cfm?

## RE: Finding variables that give a specific response.

Cheers

Greg Locock

New here? Try reading these, they might help FAQ731-376: Eng-Tips.com Forum Policies http://eng-tips.com/market.cfm?

## RE: Finding variables that give a specific response.

Cheers

Greg Locock

New here? Try reading these, they might help FAQ731-376: Eng-Tips.com Forum Policies http://eng-tips.com/market.cfm?

## RE: Finding variables that give a specific response.

clc

clear all

%% Set Variables

d1=1.6256;

d2=0.77;

d3=0.815;

b=11;

k1=3000;

k2=100;

m=967.44;

Ig=9759.19;

V=73.05555556;

rho=1.225;

dCL=10;

%% A values

a11= (1/m)*(k1+k2);

a12= (1/m)*((k1*d3)-(k2*(d1-d3))-(0.5*dCL*rho*(V^2)*d1*b));

a21= (1/Ig)*((k1*d3)-(k2*(d1-d3)));

a22= (1/Ig)*((k1*(d3^2))+(k2*((d1-d3)^2)-((0.5*dCL*rho*(V^2)*d1*b)*(d3-d2))));

%% State Space A-Matrix

A1=[0,0,1,0;-0,0,0,1;-a11,-a12,0,0;-a21,-a22,0,0];

%% Eigenvalues

eig(A1)

A=((a11+a22)/2)

B=((a11*a22)-(a12*a21))

and my ranges are now from 0 to 7e3. On a graph I need to plot all the values of k1 and k2 that give the following results:

B < 0

0 < B < A^2

B > A2

Can anon suggest code that would allow me to do it?

## RE: Finding variables that give a specific response.

k1 and k2 form my variables.

## RE: Finding variables that give a specific response.

The question "I need to plot all the values of k1 and k2" itself is ridiculous since there an infinite number of pairs k1 and k2 that will satisfy the relationship. I haven't got that long.

Greg Locock

## RE: Finding variables that give a specific response.

clear all

close all

%% Set Variables

num_runs=100000;

d1=1.6256;

d2=0.77;

d3=0.815;

b=11;

m=967.44;

Ig=9759.19;

V=73.05555556;

rho=1.225;

dCL=10;

k1=7e3*rand(num_runs,1);

k2=7e3*rand(num_runs,1);

%do a little simple maths, eliminate redundant lines

a11= (1/m).*(k1+k2);

a12= (1/m).*((k1*d3)-(k2*(d1-d3))-(0.5*dCL*rho*(V^2)*d1*b));

a21= (1/Ig)*((k1*d3)-(k2*(d1-d3)));

a22= (1/Ig)*((k1*(d3^2))+(k2*((d1-d3)^2)-((0.5*dCL*rho*(V^2)*d1*b)*(d3-d2))));

A=((a11+a22)/2);

B=((a11.*a22)-(a12.*a21));

%plot the results

plot(k1(B<0),k2(B<0),'b.')

hold on

plot(k1((B > 0)&(A.^2>B)),k2((B > 0)&(A.^2>B)),'g.')

plot(k1(B > A.^2),k2(B > A.^2),'k.')

xlabel('k1')

ylabel(' k2')

legend('B<0','0<B<A^2','B>A.^2','Location','Northwest')

Let me know what your professor thinks.

Greg Locock