How to write a function?

조회 수: 1 (최근 30일)
Den Jaka
Den Jaka 2020년 7월 3일
댓글: Den Jaka 2020년 7월 3일
Please anyone can help me write this following function in matlab

채택된 답변

Kanupriya Singh
Kanupriya Singh 2020년 7월 3일
편집: Kanupriya Singh 2020년 7월 3일
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
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개)

카테고리

Help CenterFile Exchange에서 2-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