Conversion matlab to C

Fermé
luisfranksimon Messages postés 2 Date d'inscription mardi 15 décembre 2015 Statut Membre Dernière intervention 23 novembre 2017 - 15 déc. 2015 à 18:21
Bonsoir tout le monde, s'il vous plait j'ai écrit un programme sur matlab, et je dois le convertir en C, j'ai essayer plusieurs fois avec matlab coder mais je maîtrise pas la méthode, s'il vous plait si quelqu'un peut m'aider voici le code

-------------------------------------------------------------------------------------

function test=EFdegre1;
Comparaison_degre_1();
end
function y=f(x)
y=x^4;
end
function test0=Comparaison_degre_1();
alpha=1;
beta=1;
N=16;
h=1/N;
a=0;
b=1;
K=(alpha/h)*[1,-1;-1,1];
M=(beta/3*h)*[1,0.5;0.5,1];
I=linspace(a,b,N+1);
elFinis=linspace(a,b,N+1);
g=solution_degre_1(N,h,elFinis,alpha,beta,@f,a,b,K,M);
c2=(37-24*exp(1))/(exp(1)-exp(-1));
c1=-24-c2;
s_exact=c1*exp(I)+c2*exp(-I)+I.^4+12*I.^2+24;
err=g-s_exact';
em=max(abs(err))
I=linspace(a,b,200);
s=c1*exp(I)+c2*exp(-I)+I.^4+12*I.^2+24;
hold on
p=plot(I,s);
q=plot(elFinis,g,'red');
hold off
end
function [ms]=matrixA_degre_1(N,h,elFinis,alpha,beta,K,M)
ms=zeros(N+1,N+1);
for ie=1:N
for i=1:2
ig=ie+i-1;
for j=1:2
jg=ie+j-1;
ms(ig,jg)=ms(ig,jg)+K(i,j)+M(i,j);
end
end
end
end
function [ap]=aproximationtrapezes(g)
ap=1/2*(g(0)+g(1));
end
function y=phi1(x)
y=1-x;
end
function y=phi2(x)
y=x;
end
function [l]=member2_s(elFinis,h,s,f)
x1=elFinis(s);
x2=elFinis(s+1);
l=zeros(2,1);
r1=zeros(100)
function y=r1(x)
y=f(x1+h*x)*phi1(x);
end
function y=r2(x)
y=f (x1+h*x)*phi2(x);
end
l(1)=aproximationtrapezes(@r1);
l(2)=aproximationtrapezes(@r2);
end
function [F]=vectMember2_degre_1(elFinis,h,N,f)
F=zeros(N+1,1);
for s=1:N
l=member2_s(elFinis,h,s,f);
for i=1:2
ig=s+i-1;,
F(ig)=F(ig)+h*l(i);
end
end
end
function [U]=solution_degre_1(N,h,elFinis,alpha,beta,f,a,b,K,M)
A=matrixA_degre_1(N,h,elFinis,alpha,beta,K,M);
A(1,:)=0;A(1,1)=1;
A(N+1,:)=0;A(N+1,N+1)=1;
F=vectMember2_degre_1(elFinis,h,N,f);
F(1)=0;
F(N+1)=0;
U=A\F;
end