Hi all,

I am a total mathlab newbie and hence am having trouble with even the simplest of things.

i have an m file which contains just the following 3 lines

% test func
function y = f1(x,c)
y = x*x - c

when i "run" this i get an error message

"??? Input argument 'x' is undefined.

Error in ==> C:\f1.m
On line 2 ==> y = x*x - c "

i have no clue why i am getting this.

any help would be really appreciated.

alnerdy

problem solved.

need i say i am dumb.

once f1.m is created, one needs to only call the function as so
f1(10,2) and viola .... matlab spits stuff out.

hello can u plz explicitly explain ur correctio cuz i cant get a similiar errror of mine.
thanks

commented: Don't bump old threads -1

Hi all,

I am a total mathlab newbie and hence am having trouble with even the simplest of things.

i have an m file which contains just the following 3 lines

% test func
function y = f1(x,c)
y = x*x - c

when i "run" this i get an error message

"??? Input argument 'x' is undefined.

Error in ==> C:\f1.m
On line 2 ==> y = x*x - c "

i have no clue why i am getting this.

any help would be really appreciated.

alnerdy

hih you,,,,,,,,,,,,,,,
in the matlab, it understant about input "x"
"??? Input argument 'x' is undefined.

Error in ==> C:\f1.m
On line 2 ==> y = x*x - c "
because you have written code of input "x".
you can write as matrix..
run okkkkkkkkkkkk:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.