SelfMadeGrenzWert MATHLAB 2 ?

function [leftLimit, rightLimit, twoSidedLimit] = compute_limits(f, x0)
syms x
f = matlabFunction(str2sym(f));
x0 = sym(x0);
leftLimit = limit(f(x), x, x0, 'left');
rightLimit = limit(f(x), x, x0, 'right');
if leftLimit == rightLimit
twoSidedLimit = leftLimit;
fprintf('Zweiseitiges Limit existiert!');
else
twoSidedLimit = NaN
fprintf('Zweiseitiges Limit existiert nicht!');
end
fprintf('Linkes Limit %s\n', char(leftLimit));
fprintf('Rechtes Limit %s\n', char(rightLimit));
if ~isnan(twoSidedLimit)
fprintf('Zweiseitiges Limit %s\n', twoSidedLimit);
end
end
f = '(5*x^5+3*x^2+2*x+4)/(7*x^5+8)';
x0 = 5;
[leftLimit, rightLimit, twoSidedLimit] = compute_limits(f, x0);

Answers (0)

Tags

Asked:

on 20 Jun 2024

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!