Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a = -1;
- b = 3/2;
- x = linspace(a, b, 100);
- g = @(x)((3+x-2*x.^2).^(1/4));
- plot(x, g(x), '-r');
- hold on;
- x1 = [a, b, b, a, a];
- y1 = [a, a, b, b, a];
- plot (x1, y1, 'Linewidth', 3)
- plot(x, x, '-g');
- syms arg;
- dg = matlabFunction(diff(g(arg)));
- figure;
- hold on;
- plot(x, dg(x));
- plot([a, b],[1, 1]);
- plot([a, b],[-1, -1]);
- a = 0.8;
- b = 1.27;
- % x = linspace(a, b, 100);
- % g = @(x)((3+x-2*x.^2).^(1/4));
- % syms arg;
- % dg = matlabFunction(diff(g(arg)));
- % figure;
- % hold on;
- % plot(x, dg(x));
- % plot([a, b],[1, 1]);
- % plot([a, b],[-1, -1]);
- figure;
- hold on;
- f = @(x)(x.^4 + 2*x.^2 - x - 3);
- plot(x, f(x));
- plot([a, b], 0)
- xsol = punctFix(g, 1, 10^(-5));
- plot(xsol, f(xsol), 'o', 'MarkerSize', 10);
- function xsol = punctFix(g, x0, eps)
- x = g(x0);
- while(abs(x - x0) < eps)
- x0 = x;
- x = g(x0);
- end
- xsol = x;
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement