Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

clc;

clear all;

funPolohy= @(t) t.^3-6*t.^2-15*t+40

funPolohy = function_handle with value:


@(t)t.^3-6*t.^2-15*t+40

%zobrazenie funkcie
fplot(funPolohy,[0,10])

%nájdenie koreňa č.1


x1=[7,8]

x1 = 1×2
7 8

koren1= fzero(funPolohy,x1)

koren1 = 7.3039

grid on
%nájdenie koreňa č.2
x2=[1,4]

x2 = 1×2
1 4

koren2= fzero(funPolohy,x2)

koren2 = 1.7774

hold on

y0=0

y0 = 0

%vykreslenie koreňov
plot(koren1,y0,"rd","LineWidth",4)
hold on
plot(koren2,y0,"rd","LineWidth",4)
title("Priebeh zrýchlenia")
xlabel("čas [s]")
ylabel ("Zrýchlenie [m/s2]","FontWeight","bold")
hold off

1
syms t
x= t.^3-6*t.^2-15*t+40

x = 

% derivovanie pre získanie priebehu rýchlosti


V= diff(x)

V = 

VV= @(t) 3*t.^2-12*t-15

VV = function_handle with value:


@(t)3*t.^2-12*t-15

VV0=[0,10]

VV0 = 1×2
0 10

fplot(VV,[0,10])
x1=[4,6]

2
x1 = 1×2
4 6

%nájdenie koreňa a jeho vykreslenie


korenVV= fzero(VV,x1)

korenVV = 5.0000

hold on
grid on
plot(korenVV,y0,"gd","LineWidth",3)
title("Priebeh rýchlosti")
xlabel("čas [s]")
ylabel ("Rýchlosť [m/s]","FontWeight","bold")
hold OFF

% derivovanie druhého stupňa pre získanie priebehu polohy


A=diff(x,2)

A = 

AA= @(t) 6*t-12

AA = function_handle with value:


@(t)6*t-12

AA0=[0,10]

3
AA0 = 1×2
0 10

fplot(AA,[0,10])
x1=[1,3]

x1 = 1×2
1 3

%nájdenie koreňa a jeho vykreslenie


korenAA= fzero(AA,x1)

korenAA = 2

hold on
grid on
plot(korenAA,y0,"gd","LineWidth",3)
title("Priebeh polohy")
xlabel("čas [s]")
ylabel ("Poloha [m]","FontWeight","bold")

You might also like