Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: How to solve very complex equations in matlab?
Replies: 13   Last Post: Jul 6, 2013 7:20 AM

 Messages: [ Previous | Next ]
 Torsten Hennig Posts: 2,419 Registered: 12/6/04
Re: How to solve very complex equations in matlab?
Posted: Jul 5, 2013 6:49 AM

> part of the code:
> a and b are vectors of some length of 1500. They are
> declared above. Not shown here.
> sum1=0;
> for j=1:length(a)
> f1=func_1(x,y,z,a(j),b(j)); %func_1 is called
> sum1=sum1+f1;
> end
> I have written the func_1.m separately as
> function f1=func_1(x,y,z,c,d)
> f1=@(x,y,z)(2*((c-x)*sin(z)-2*(d-y)*cos(z))+2*((c-x)*c
> os(z)+2*(d-y)*sin(z)));
>
> I am getting an error like this:
> Undefined function 'plus' for input arguments of
> type 'function_handle'.
>
> Error in cc (line 28)
> sum1=sum1+f1;

If you take a look in my third reply, you will see that
the function file must look like

function f1=func_1(x,y,z,c,d)
f1=2*((c-x)*sin(z)-2*(d-y)*cos(z))+2*((c-x)*c
os(z)+2*(d-y)*sin(z)));

Of course, x,y and z also have to be given numerical values before func_1 is called.

Best wishes
Torsten.

Date Subject Author
7/4/13 Srinath
7/4/13 Torsten Hennig
7/4/13 Srinath
7/4/13 Torsten Hennig
7/4/13 Srinath
7/4/13 Torsten Hennig
7/4/13 Srinath
7/5/13 Torsten Hennig
7/5/13 Srinath
7/5/13 Torsten Hennig
7/5/13 Srinath
7/5/13 Torsten Hennig
7/5/13 Srinath
7/6/13 Torsten Hennig