×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Are you an
Engineering professional?
Join Eng-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• 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.

# 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?

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

#### Resources

Low-Volume Rapid Injection Molding With 3D Printed Molds
Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now
Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a partâ€™s function at the center of their design considerations. Download Now
Industry Perspective: Education and Metal 3D Printing
Metal 3D printing has rapidly emerged as a key technology in modern design and manufacturing, so itâ€™s critical educational institutions include it in their curricula to avoid leaving students at a disadvantage as they enter the workforce. Download Now

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:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!