Borrar filtros
Borrar filtros

illogical solution. How can i fix it?

2 visualizaciones (últimos 30 días)
Physiker192
Physiker192 el 15 de Ag. de 2014
Editada: Star Strider el 15 de Ag. de 2014
i have this code written to solve the system of equations saved in the array (dif) it does everything that i should do but the problem is that whenever i run my program i always get 0 as a solution.
n=input('n=');
E=input('E=');
h=3;
dif=sym(zeros(1,n));
F=0;
x=sym(zeros(1,n));
for k=1:n
x(k) = sym(sprintf('x%d',k));
end
for i=1:n
D= 0.5;
% V=0;
% b=0;
for j=1:n
if (mod(j,2)==0)
D = D + cos(h*x(j));
else
D = D - cos(h*x(j));
end
end
D=(2*E*sqrt(2)/(pi*h))*abs(D);
F = F + 1/h*(D^2);
h=h+2;
end
for j=1:n
dif(j)=diff(F,x(j),1);
end
S=double(solve(dif));
x = structfun(@subs,S)
can anybody tell me what's wrong with this code? thanks in advance.

Respuestas (0)

Etiquetas

Aún no se han introducido etiquetas.

Community Treasure Hunt

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

Start Hunting!

Translated by