MATLAB: How to convert Maple Code to Matlab Code

convert maple to matlabmaple

I am currently learning MatLab with no experience with Maple of Matlab. How do I convert the following Maple code to MatLab?
basisfunctions := matrix(3,1,
[ (xh/2)*(xh) / (0h/2) / (0h),
(x0)*(xh) / (h/20) / (h/2h),
(x0)*(xh/2) / (h0) / (hh/2) ]);
A := matrix(3,3):
for i from 1 to 3 do
for j from 1 to 3 do
A [i,j] := simplify(int(
diff(basisfunctions[i,1],x)
* diff(basisfunctions[j,1],x) , x=0..h )):
end do:
end do:
evalm(A);

Best Answer

syms x h
basisfunctions = [ (xh/2)*(xh) / (0h/2) / (0h);
(x0)*(xh) / (h/20) / (h/2h);
(x0)*(xh/2) / (h0) / (hh/2) ];
A = sym(zeros(3,3);
for i = 1 : 3
for j = 1 : 3
A(i,j) = simplify( int( diff(basisfunctions(i,1), x) * ...
diff(basisfunctions[j,1],x), x, 0, h ));
end
end
A