フィルターのクリア

How can I tackle basic calculus on MATLAB?

1 回表示 (過去 30 日間)
Andy
Andy 2022 年 12 月 9 日
回答済み: Sai 2022 年 12 月 28 日
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 件のコメント
Rik
Rik 2022 年 12 月 9 日
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.

サインインしてコメントする。

回答 (1 件)

Sai
Sai 2022 年 12 月 28 日
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'.

カテゴリ

Help Center および File ExchangeNumerical Integration and Differential Equations についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by