MATLAB Week-4
MATLAB
Week: 4
clc
clear all
syms x y
y1=input('Enter the Y1
Region value')
y2=input('Enter the Y2
Regon value')
ez1=ezplot(char(y1))
hold on
ez2=ezplot(char(y2))
hold on
t=solve(y1-y2)
kokler=double(t)
x1=linspace(kokler(1), kokler(2))
yy1=subs(y1,x,x1)
yy2=subs(y2,x,x1)
x1=[x1,x1]
yy=[yy1,yy2]
fill (x1,yy,'g')
f=int(y1-y2,t(1),t(2))
Question 1) y=x^2-2*x, y=x
Maxima and Minima
clc
clear all
syms x real
f=input('Enter the
function f(x):')
fx=diff(f,x)
c=solve(fx)
cmin=min(double(c))
cmax=max(double(c))
ezplot(f,[cmin-2,cmax+2])
hold on
fxx=diff(fx,x)
for i = 1:1:size(c)
T1=subs(fxx,x,c(i))
T3=subs(f,x,c(i))
if (double(T1)==0)
sprintf('The point x is inflexion point %d', double (c(i)))
else
if (double(T1)<0)
sprintf('The maximum point x is %d', double (c(i)))
sprintf ('The value of the function %d', double (T3))
else
sprintf('The minimum point x is %d', double (c(i)))
sprintf('The value of the function is
%d',
double(T3))
end
end
plot (double(c(i)), double(T3), 'r*', 'markersize', 15)
end
hold off
Question 1) 4*x^3-48*x^2+144*x


Comments
Post a Comment