convert to double equation

1 vue (au cours des 30 derniers jours)
Aakash Divakar
Aakash Divakar le 14 Oct 2020
Commenté : RenatoL le 15 Oct 2020
my function gives an error while converting to double a one place (marked as %****) while at other places it works fine.
syms Y4(x)
syms Y1(x)
syms Y2(x)
syms Y5(x)
syms Y7(x)
syms Y3(x)
syms Y6(x)
sym =x
syms a
syms b
v=input('velocity ');
cl=input('Cl ');
%to plot elliptical lift distribution
w=input('total weight ');
ws=input('half wing span ');
disp(ws);
b1=double(9.81*(4*(w/2))/(2*pi*ws));
disp(b1);
Y7(x)=(b1/(ws))*((ws^2-x^2))^0.5;
disp(Y7(x));
n=input('no of sections ');
k=input('no. of tapered section');
for i=1:n
m=0;
c=0;
cr=input('Root cord for that section ');
ct=input('tip cord for that section ');
l1=input('length of that section ' );
L1=double((1.225*cl*(v^2)*cr)/2); %lift distribution per unit span
L2=double((1.225*cl*(v^2)*ct)/2);
disp(L1);
disp(L2);
if cr==ct
m=0;
c=L1;
if i==1 && k==1;
Y1(x)=-(m/2)*x+(c/2); %linear lift eqn untapered section
else n==3 && i==2;
Y2(x)=-(m/2)*x+(c/2); %linear lift eqn untapered section
end
else
if k==2
m=double((L1-L2)/l1);
c=L1;
Y1(x)=-(m/2)*x+(c/2); %linear lift eqn tapered section
else
l2=input('starting point of the taper section ');
m=double((L1-L2)/l1);
disp(m);
c=L1+m*l2;
disp(c);
Y3(x)=-(m/2)*x+(c/2); %linear lift eqn tapered section
end
end
end
Y4(x)=Y1(x)+Y7(x); % schrenk eqn untapered section
Y5(x)=Y2(x)+Y7(x); %schrenk eqn untapered section
Y6(x)=Y3(x)+Y7(x); % schrenk eqn tapered section
%VIT schrenk eqn
% Y1=-0*x+33.037;
% Y2=-27.10*x+37.02;
% Y4(x)=(-0*x+33.037/2 +(110.825*(0.1296-x^2)^0.5)/2);
% Y5(x)=((-27.10/2)*x+37.02/2 +(110.825*(0.1296-x^2)^0.5)/2);
xv=0;
I=[];
W1=input('length of first section ');
if n==3
W2=input('length of 2nd section ');
end
if n==3
while xv(end)<= (ws+0.01) % to plot shear force with 3 sections
if xv(end) <=W1
I(end+1)=double(int(Y4,x,0,xv(end)));
elseif xv(end)>=W1 && xv(end)<=W2
I(end+1)=double(int(Y5,x,0,xv(end)));
else
I(end+1)=double(int(Y6,x,0,xv(end))); %****
end
xv(end+1)=xv(end)+0.01;
end
else
while xv(end)<= (ws+0.01) % to plot shear force with 2 sections
if xv(end) <=W1
I(end+1)=double(int(Y4,x,0,xv(end)));
else
I(end+1)=double(int(Y6,x,0,xv(end)));
end
xv(end+1)=xv(end)+0.01;
end
end
xv(end)=[];
xy=0;
a=0;
I2=int(Y4,a,x)
I4=int(Y5,a,x)
I5=int(Y6,a,x)
I3=[];
if n==3
while xy(end)<=(ws+0.01) % to plot BM with 3 sections
if xy(end)<=W1
I3(end+1)=double(int(I2,x,0,xy(end)));
elseif xy(end)>=W1 && xy(end)<=W2
I3(end+1)=double(int(I4,x,0,xy(end)));
else
I3(end+1)=double(int(I5,x,0,xy(end)));
end
xy(end+1)=xy(end)+0.01;
end
else
while xy(end)<=(ws+0.01) % to plot BM witH 2 section
if xy(end)<=W1
I3(end+1)=double(int(I2,x,0,xy(end)));
else
I3(end+1)=double(int(I5,x,0,xy(end)));
end
xy(end+1)=xy(end)+0.01;
end
end
xy(end)=[];
plot(xy,I3);grid %BM graph
% plot(xv,I);grid %shear force graph
  1 commentaire
RenatoL
RenatoL le 15 Oct 2020
Can you include the error message in the question? That would really help.

Connectez-vous pour commenter.

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by