How can I tackle basic calculus on MATLAB?

1 visualización (últimos 30 días)
Andy
Andy el 9 de Dic. de 2022
Respondida: Sai el 28 de Dic. de 2022
A manufacturer of luxury cars would like to investigate an automatic system for smooth braking. From data collected from professional drivers, they have determined that the following equation describes a good starting point for the desired velocity as a function of time.
where
Note that and T are randomly generated.
Implement a MATLAB function that takes time t, and T as inputs and returns acceleration, a, velocity, v, and displacement, x. Write your function so that it works also when t is a vector of values. Remember that if displacement is x, then velocity and acceleration.
  1 comentario
Rik
Rik el 9 de Dic. de 2022
You can find guidelines for posting homework on this forum here. If you have trouble with Matlab basics you may consider doing the Onramp tutorial (which is provided for free by Mathworks). If your main issue is with understanding the underlying concept, you may consider re-reading the material you teacher provided and ask them for further clarification.

Iniciar sesión para comentar.

Respuestas (1)

Sai
Sai el 28 de Dic. de 2022
I understand that you are trying to implement a MATLAB function which determines and returns displacement(x), velocity(v) and acceleration(a) from the given time dependent equation taking t and T and v_0 as inputs. I hope the following code snippets helps you for better understanding and getting the expected output.
function [x,v,a] = basic_calculus(v_0,t,T)
v = v_0*(1 - ((t/T).^4)).^2;
a = diff(v);
v1 = @(t) v_0*(1 - ((t/T).^4)).^2;
x = integral(v1,0,max(t));
end
The above snippet contains the called function. Below code snippet contains the calling function. Both are saved in different '.m' files
t = 0:0.1:10;
[x,v,a] = basic_calculus(rand(),t,rand())
Refer to the below documentation links for more information on writing functions in MATLAB, and using 'diff', 'integral'.

Categorías

Más información sobre Numerical Integration and Differential Equations en Help Center y File Exchange.

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by