Please anyone can help me write this following function in matlab

 採用された回答

Kanupriya Singh
Kanupriya Singh 2020 年 7 月 3 日
編集済み: Kanupriya Singh 2020 年 7 月 3 日

0 投票

The syntax for declaring a function in MATLAB is: function [y1,...,yN] = myfun(x1,...,xM)
In your case, the function defintion would be:
function v = func_name(m, g, k, t, r)
v = ((m*g)/k)^0.5 * (1 - exp(-t/r))./(1+exp(-t/r));
end
For further reference on writing functions: https://www.mathworks.com/help/matlab/ref/function.html

4 件のコメント

Den Jaka
Den Jaka 2020 年 7 月 3 日
Thank you sir. I have another question. m,g,k and r are constant, how to plot v function with respect to t
madhan ravi
madhan ravi 2020 年 7 月 3 日
v = ((m*g)/k)^0.5 * (1 - exp(-t/r)) ./ (1+exp(-t/r));
%^
plot(t, v)
Kanupriya Singh
Kanupriya Singh 2020 年 7 月 3 日
@Den Jaka as mentioned in the above comment, you can use the plot function to plot function v against t.
Syntax: plot(X,Y)
For further reference on plotting graphs: https://www.mathworks.com/help/matlab/ref/plot.html
Den Jaka
Den Jaka 2020 年 7 月 3 日
Oke thanks

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by