Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Problem with a function in Matlab

Subject: Problem with a function in Matlab

From: Raphael

Date: 18 May, 2012 09:46:12

Message: 1 of 5

Hello everybody! I have a little problem and I hope have an answer here. Sorry for my bad english, I am french and I don't speak English very well. :)
I have a very simple function J(x,A,B) which returns y =0.5*x'*A*x-B'*x;

When I write in the script:
a=[1;2]
b=0.5*a'*An*a-Bn'*a;
it works without problem and Matlab returns the value of b. (there is no problem with dimensions)
but when I call the funtion J:
b=J(a,An,Bn)
Matlab displays a error: "Undefined function or method 'J' for input arguments of type 'double'."
I don't understand where this error comes from.
Can anyone help me? :=)

Subject: Problem with a function in Matlab

From: Greg Heath

Date: 18 May, 2012 09:50:01

Message: 2 of 5

On May 18, 5:46

Subject: Problem with a function in Matlab

From: Roger Stafford

Date: 19 May, 2012 00:06:20

Message: 3 of 5

Greg Heath <g.heath@verizon.net> wrote in message <9f633a9a-28eb-4667-b751-bb80dfcd89ea@ec4g2000vbb.googlegroups.com>...
> On May 18, 5:46
- - - - - - - - - - - -
  Hello Greg. In the Matlab Central Newsgroup your response in this thread reads (at least on my computer) as just the fifteen character string:

"On May 18, 5:46"

whereas the same article on Google Groups reads:

"On May 18, 5:46=A0am, "Raphael " <raphael.hert...@gmail.com> wrote:
> Hello everybody! I have a little problem and I hope have an answer here. =
Sorry for my bad english, I am french and I don't speak English very well. =
:)
> I have a very simple function J(x,A,B) which returns y =3D0.5*x'*A*x-B'*x=
;
>
> When I write in the script:
> a=3D[1;2]
> b=3D0.5*a'*An*a-Bn'*a;
> it works without problem and Matlab returns the value of b. (there is no =
problem with dimensions)
> but when I call the funtion J:
> b=3DJ(a,An,Bn)
> Matlab displays a error: =A0"Undefined function or method 'J' for input a=
rguments of type 'double'."
> I don't understand where this error comes from.
> Can anyone help me? :=3D)

Show the code that defines the function J

Hope this helps.

Greg"

  Have you had trouble like this with other submissions made via Google Groups? I wonder if this omission is related to the "=A0" characters appearing between "5:46" and "am" in the above text and whether it is Google's fault or Mathworks'.

Roger Stafford

Subject: Problem with a function in Matlab

From: Greg Heath

Date: 19 May, 2012 19:40:22

Message: 4 of 5

On May 18, 8:06

Subject: Problem with a function in Matlab

From: Greg Heath

Date: 19 May, 2012 19:43:31

Message: 5 of 5

On May 18, 8:06

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us