How to create function

4 visualizaciones (últimos 30 días)
Jonathan Larsson
Jonathan Larsson el 1 de Oct. de 2019
Comentada: David K. el 1 de Oct. de 2019
Hello I am woundering how you do this function;
8d1487d3-eb42-40f2-bf66-8442b675fd02.png ,om = if, och=and
I am supposed to do it with
function f = fun(x,y)
something...
end
Thanks in advance!
  3 comentarios
Jonathan Larsson
Jonathan Larsson el 1 de Oct. de 2019
I am supposed to give a function two values of x and y, and it will give me what the picture says. Having hard time doing if in a function, always shows error...
David K.
David K. el 1 de Oct. de 2019
Could you post the code you have and what the error is so that we can help you with that?
If the main problem is that the code you made works outside of a function and not inside, then one of my guesses to what the error could be is that the function and the file name need to be the same. EX. f = fun(x,y) needs to be saved as fun.m

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by