×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Finding variables that give a specific response.

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?
Replies continue below

Recommended for you

RE: Finding variables that give a specific response.

(OP)
My code has actually changed a little:

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.

(OP)
Sorry I forgot to remove

k1 and k2 form my variables.

RE: Finding variables that give a specific response.

Well sure, I could write the code, I think it needs a maximum of 7 new lines to do that, and 2 modified ones,but I rather wonder what you'd learn from it.

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.

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
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.

Cheers

Greg Locock


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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login



News


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close