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**

# Basic MATLAB

Know someone interested in this topic? Share a link to this question via email,
Google+,
Twitter, or
Facebook

Have something to add?

- Similar discussions for: Basic MATLAB

Loading...

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