How to write a function?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Den Jaka
el 3 de Jul. de 2020
Comentada: Den Jaka
el 3 de Jul. de 2020
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/326318/P_20200703_221948_1.jpg)
Please anyone can help me write this following function in matlab
0 comentarios
Respuesta aceptada
Kanupriya Singh
el 3 de Jul. de 2020
Editada: Kanupriya Singh
el 3 de Jul. de 2020
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 comentarios
Kanupriya Singh
el 3 de Jul. de 2020
@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
Más respuestas (0)
Ver también
Categorías
Más información sobre Environment and Settings en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!