-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExp6_2.m
More file actions
40 lines (36 loc) · 871 Bytes
/
Copy pathExp6_2.m
File metadata and controls
40 lines (36 loc) · 871 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
clc
clear all
close all
syms x y
f = x^4 - y^4 - 2*x^2 + 2*y^2;
fx = diff(f, x);
fy = diff(f, y);
[xc, yc] = solve([fx==0,fy==0],[x,y]);
K = [xc, yc];
disp('Stationary Points are:')
disp(K);
r = diff(fx,x);
t = diff(fy,y);
s = diff(fx,y);
for i = 1:length(xc)
xc1 = xc(i);
yc1 = yc(i);
r1 = subs(r,[x,y],[xc1,yc1]);
s1 = subs(s,[x,y],[xc1,yc1]);
t1 = subs(t,[x,y],[xc1,yc1]);
D = r1*t1 - s1^2;
if D > 0
if r1 > 0
M = 'MINIMA';
fmin = subs(f,[x,y],[xc1,yc1])
else
M = 'MAXIMA';
fmax = subs(f,[x,y],[xc1,yc1])
end
elseif D < 0
M = 'SADDLE POINT';
else
M = 'INCONCLUSIVE';
end
fprintf('point(%s,%s):%s\n',char(xc1),char(yc1),M);
end