Please change this code from inline to function.
2 views (last 30 days)
Show older comments
clear all
clc
format short
f1=inline('2*x.^3+y.^3+x.*y-6');
f2=inline('x.^3-y.^3+x.*y-4;');
clear i
X0=[i 1+i]; X1=[-i i-2]; X2=[i+1 1];
for k=1:21
M=[X0 1; X1 1; X2 1];
v=[f1(X0(1),X0(2)); f1(X1(1),X1(2)); f1(X2(1),X2(2))];
c1=M\v;
v=[f2(X0(1),X0(2)); f2(X1(1),X1(2)); f2(X2(1),X2(2))];
c2=M\v;
c=[c1';c2'];
X=-c(1:2,1:2)\c(:,3);
X0=X1; X1=X2; X2=X';
end
Accepted Answer
Star Strider
on 11 Apr 2021
This is straightforward —
f1=inline('2*x.^3+y.^3+x.*y-6');
f2=inline('x.^3-y.^3+x.*y-4;');
magickally becomes —
f1 = @(x,y) 2*x.^3+y.^3+x.*y-6;
f2 = @(x,y) x.^3-y.^3+x.*y-4;
0 Comments
More Answers (0)
See Also
Categories
Find more on Function Creation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!