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 | Science Articles, Homework Help, Discussion**

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

**Physics Forums | Science Articles, Homework Help, Discussion**