This is a tutorial on how to write custom functions in MATLAB. Table of contents below.
00:00 – Introduction
00:33 – General form
01:26 – Example function declaration
02:08 – Calling a function
03:05 – Function workspace isolation
04:30 – Example function code
05:49 – Explanation of function code
06:31 – Calling a function with fewer output arguments
07:08 – Conclusion
Amazon Auto Links: No products found.
Thanks a lot, it was really useful.
Greetings from Spain!
Hey, if I have to create a function with 2 input arguments (vectors) and the output should be the value of the derivative, how is it written?
SALAM! My matlab says “The selected cannot be evaluated because it contain invalid statement” WHILE i have tried different techniques… even wrote as same as yours…
Hi I was wondering if you have any expertise with the “comet” function and would be able to help me sort out some code?
I have this code here:
a=(1:0.5:1000);
angle=a.*75;
x=cos(angle);
y=sin(angle);
t=0.5;
Ex=x.*Er;
Ey=y.*Er;
DELAY = 1;
%edit comet
%axis=5*10^12;
comet(Ex,Ey,0)
%axis([-axis axis -axis axis]);
And it works except for the fact that it’s too fast! I can’t get it to slow down with any pause or delay functions, any ideas?
how can i input any function i want in matlab. i mean something like (input(‘enter yout function’))
ty
thank you for this example, very helpful 🙂
than u very much
well said!
Thanks a lot.
very good!!!
Hey, How to write a function that its number of outputs depends on the value of its input…for example:
[n1,n2,………nr]=myfunction(r)
is this possible in Matlab?
Thank you so much, that was awesome explained
Great Video!
Thank you SO much! It’s 3 am and I’ve been struggling so much! You are amazing.
For more understanding watch this video:
https://youtu.be/t6062Nwt0JE
Thanks a lot, it was really useful.
very very good!
An outstanding tutorial, clear and with valuable common/standard practice issues. Same for the other tutorials on your channel. A very good balance between capability and options.
Thanks so much ….
function function function function function function function function function function function function function function function function function function function function function function function function function function function function function function
Excellent tutorial sir
wow just awesome. thanks for this very detail and well explain video
Very helpful! Thanks Ilya