symbolic error in calculation

7 visualizaciones (últimos 30 días)
yogeshwari patel
yogeshwari patel el 13 de Nov. de 2022
Comentada: yogeshwari patel el 23 de Nov. de 2022
syms x
syms a
syms t
syms f % f fractional order
syms r % r cut
% syms m
% m=0.7;
U=zeros(1,2,'sym');
A=zeros(1,2,'sym');
B=zeros(1,2,'sym');
series(x,t)=sym(zeros(1,1));
U(1)=(r-1)/((1+exp(x))^2);
r=0.3
r = 0.3000
for k=1:4
A(1)=0;
for i=1:k
A(1)=A(1)+U(i)*U(k-i+1) ;
end
U(k+1)=simplify(gamma((f*(k-1)+1))/gamma((f*(k)+1))*(diff(U(k),x,2)+6*U(k)-6*A(1)));
end
disp (U)
for k=1:5
series(x,t)=series(x,t)+U(k)*(power(t,k-1));
end
series
series(x, t) = 
C=zeros(1,1);
for x=1:5
e=x;
for t=1:5
f=(t)/10;
C(x,t)=series(e,f);
end
end
Unable to perform assignment because value of type 'sym' is not convertible to 'double'.

Caused by:
Error using symengine
Unable to convert expression containing symbolic variables into double array. Apply 'subs' function first to substitute values for variables.
vpa(C,15)
The last for loop is not evaluating the numerical value .Previously when I use the code the values were evaluated but now its showing the error.
  5 comentarios
yogeshwari patel
yogeshwari patel el 23 de Nov. de 2022
thank you

Iniciar sesión para comentar.

Respuestas (1)

Bhavana Ravirala
Bhavana Ravirala el 16 de Nov. de 2022
The last for loop is failing because you are trying to assign sym variable (output of ‘series’ is a sym variable) to double variable. To eliminate this error, define C as a sym variable which gives a numeric output.
C=zeros(1,1,sym);
  2 comentarios
yogeshwari patel
yogeshwari patel el 23 de Nov. de 2022
thank you

Iniciar sesión para comentar.

Categorías

Más información sobre Numbers and Precision en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by