Scattering in a loop.

3 views (last 30 days)
Addison
Addison on 5 Dec 2014
Commented: Addison on 5 Dec 2014
Hi I am doing a 2DOF study on aerolasticity of a wing aerofoil. I'm still very new to matlab and not having much luck finding the answer to the following.
From a statespace model, I have 3 types of possible responses: stable, diverge or flutter. I want to put all of my values of k1 and k2 when it is diverging or fluttering.
My problem is that by doing the following, I have hundreds of graph being plot. I tried to use the function hold on, and havent been able to get anywhere with this.
I thank you in advance for your help.
%First setting variables%
d1=2.64;
d2=1.29;
d3=0.66;
s=5.5;
m=810;
I=2885;
V=123;
l=0.74;
x=0;
y=0;
for j=1:100
for i=1:1000
k1=0+10i;
k2=0+(j/100)*i;
%Setting up the terms for eigenvalues%
a11= (k1+k2)/m;
a12= (((k1*d3)-(k2*d1+ k2*d3))-(0.5*10*l*(V^2)*d1*s))/m;
a21=((k1*d3)-(k2*(d1-d3)))/I;
a22=((k1*(d3^2))+(k2*((d1-d3))-((0.5*10*l*(V^2)*d1*s)*(d3-d2))))/I;
%Setting terms for checking the stability of the aerofoil%
A=(a11+a22)/2;
B=(a11*a22)-(a12*a21);
Y1=(-sqrt(-A-sqrt(A^2-B)));
Y2=(-sqrt(-A+sqrt(A^2-B)));
Y3=(sqrt(-A+sqrt(A^2-B)));
Y4=(sqrt(-A-sqrt(A^2-B)));
if B<0
display k1
display k2
figure;
scatter(k1,k2);
end
end
end

Answers (1)

Adam
Adam on 5 Dec 2014
You get hundreds of figures because you are using the
figure;
instruction which will create a new figure for you every time.
hold on
should work fine without that, although plotting potentially 100,000 scatter plots on an axes seems like it will just lead to a mess unless B < 0 is only true for a tiny number of cases.
  1 Comment
Addison
Addison on 5 Dec 2014
Thank you that really helped !
the 100 000 scatter plot, I could change just by changing the coefficient of i.
Again,
Thanks

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!