Make Smooth Curves using the points

조회 수: 4(최근 30일)
Deepak Kumar Agrawal
Deepak Kumar Agrawal 2015년 3월 24일
편집: Andrew Newell 2015년 3월 24일
please help me to join the points to make smooth curve. the programme is given below
syms x real
h1=4;
h21=0.25;
h31=0.75 ;
b=20 ;
lh1=50 ;
h2=h21*h1;
h3=h31*h1;
l1=lh1*h1;
h12=1/h21;
h32=h3/h2;
c=h1+2*h2+h3;
k=[1 2 3]
l=[1 2 3]
% 1.p-p case
w=sin(pi*k.*x);
u=cos(pi*l.*x);
w;
wx=diff(w,1);
wxx=diff(w,2);
u ;
ux=diff(u,1);
uxx=diff(u,2);
E1=20000000;
E31=1 ;
E3=E31*E1;
A1=2*h1*b;A3=2*h3*b;
alpha=E1*A1/(E3*A3);
I1=b*(2*h1)^3/12;I3=b*(2*h3)^3/12;
D=E1*I1+E3*I3;
for g=[0.05:0.02:0.55];
n=0.003;
g1=g*(1+n*j);
m1=w'*w;
m=int(m1,0,1);
ka1=wxx'*wxx;
ka=int(ka1,0,1);
kc1=wx'*wx;
kc=int(kc1,0,1);
p0=0.05;
kb=(3*g1*(1+(h12+h32)/2)^2)-p0;
k11=ka+kb*kc;
kd1=-1.5*g1*h12*lh1*(1+alpha)*(1+(h12+h32)/2);
kd2=wx'*u;
kd3=int(kd2,0,1);
k12=kd1*kd3;
ke1=3*lh1*lh1*(1+(alpha^2)*E31*h31)/(1+E31*(h31^3));
ke2=ux'*ux;
ke3=int(ke2,0,1);
kf1=0.75*g1*lh1*lh1*h12*h12*((1+alpha)^2);
kf2=u'*u;
kf3=int(kf2,0,1);
k22=(ke1*ke3)+(kf1*kf3);
ik=inv(k22);
k=k11-k12*ik*(k12');
H=kc;
H1=ik*H;
H2=vpa(H1,6);
[V,D]=eig(H2);
eig_val1=1/D(1,1);
X1=real(eig_val1);
eig_val2=1/D(2,2);
X2=real(eig_val2);
eig_val3=1/D(3,3);
X3=real(eig_val3);
plot(g,X1,'*',g,X2,'*-',g,X3,'*-');
hold on
axis([0.05 0.55 12000 16000])
end;

답변(1개)

Andrew Newell
Andrew Newell 2015년 3월 24일
편집: Andrew Newell 2015년 3월 24일
The reason your points are not connected is that you are plotting them one at a time. You need to create some vectors and plot them all at once. Above the loop, define
g = 0.05:0.02:0.55;
X1 = zeros(size(g)); X2 = X1; X3 = X1;
Then use an index for the loop instead of g:
for ii=1:length(g)
(you don't need a semicolon at the end of a for statement). Inside the loop, replace each g by g(ii), each X1 by X1(ii) etc. Finally, take your plot commands out of the loop and put them at the bottom. Note also that in
plot(g,X1,'*',g,X2,'*-',g,X3,'*-')
you're missing the dash for X1.

Community Treasure Hunt

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

Start Hunting!

Translated by