what the value of array in decimal

1 view (last 30 days)
F(1)=0;
F(2)=1;
F(3)=-5;
for k=1:10
A=0;
for m=1:k
A=A-2*a1*Re*F(m)*(k-m+1)*F(k-m+2);
end
F(k+3)=(A/((k)*(k+1)*(k+2)))-((4*a1^2*k*F(k+1))/((k)*(k+1)*(k+2)));
end
% disp(F)
for k=1:1:12
series1(x)=series1(x)+F(k)*(power(x,k-1));
end
series1
for x=1:11
e=(x-1)/10
U1(x)=series1(e)
end
I want the value of U1(x) in decimal form .I use the command disp( U1) ,it is no doubt displaying the value but in the fraction form and Iwant in decimal form.In addition to that I want to plot the graph for different value of e.

Accepted Answer

Walter Roberson
Walter Roberson on 16 Mar 2021
a1 and Re are undefined.
series1 and x are undefined at the point where you first use them.
I suspect that you initialized
syms x
which is not the proper thing to do in this case: if x is symbolic then series1(x) would be a symbolic function, but you cannot define a symbolic function in terms of itself (the series(x) on the right hand side.)
  6 Comments
Walter Roberson
Walter Roberson on 18 Mar 2021
It means that my demonstration is running on a system that does not support input(), so I arranged the code to detect that it is not running on Windows and to use constant values for alpha and Re. If the same code were to be run on Windows it would prompt for inputs.
YOGESHWARI PATEL
YOGESHWARI PATEL on 19 Mar 2021
Thank you .I got the solution.

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!