Info
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
help with creating a function
    4 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
how can i create this function which is named "myfun"
f(x,y) = sin(x+y)  if x<y
            cos(x + y/x) if x=y
            e^y/x  if x>y
1 Commento
  Muhammad Adeel Ahsan Awan
 il 9 Apr 2020
				What exactly do you want ?
Would x and y be given in input or you just want to print the implicit equations ?
Risposte (1)
  BN
      
 il 9 Apr 2020
        Try this
function F = myfun(x,y)
%UNTITLED Summary of this function goes here
%   Detailed explanation goes here
if x<y
    F =  sin(x+y);
end
if x == y
   F = cos(x + (y/x));
end
if x>y
    F = exp(y/x);
end
end
2 Commenti
  BN
      
 il 9 Apr 2020
				Nothing, Just open new script page from Matlab then save the code into it and then save it on desktop for example. then choose desktop as a current folder. now you can call function like this:
T = myfun(1,3)
% or 
something = myfun(6,6)
you can use any x or y 
Questa domanda è chiusa.
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


