Hi,(adsbygoogle = window.adsbygoogle || []).push({});

I am trying to put a eqn in a function. So i can just type this function file name into another to find out the answers. This is what i got from the question:

function y = f1(x) %required function name

y=f1(x)

x=(x1,x2)

f1(x1,x2)=x1*5+x2*3

what i did :

function y = f1(x)

x=[x1,x2];

y=x1*5+x2*3;

end

It said Error in ==> f1 at 2 x = [x1,x2];

what im thinking is y is output and x is input here. So i declare the x to be x1,x2 and then declare the eqn of y. What should i do to fix this out?

Thanks

**Physics Forums - The Fusion of Science and Community**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Basic MATLAB

Loading...

Similar Threads - Basic MATLAB | Date |
---|---|

Issues with basic Matlab command | Sep 27, 2014 |

Matlab basic - how to get around floating point? | Aug 30, 2014 |

Matlab - basic script | Nov 6, 2013 |

Basic matlab q on writing error messages | Aug 31, 2011 |

Basic matlab help with plotting | Aug 4, 2011 |

**Physics Forums - The Fusion of Science and Community**