Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create a function of the code

Status
Not open for further replies.

ollenystrom

Electrical
Oct 6, 2006
4
Hi,

I have a program in which I will have to put a large part of it in a loop. I need to create a function of this part, which have a few input parameters, which are both matrices and integer values, and that returns a few number of output values.

Exmple(par1,par2,par3 etc)= for i=1..n
result=function(par1,par2,etc)
result

function is also a mathcad program and result should be a vector.

Anyone has any ideas?

Thanks in advance!
 
Replies continue below

Recommended for you

I'm used to program in matlab where these sort of stuff is easy but I can't find the appropriate way to do this. The part I need to write as a function contains a lot of function fitting and optimization as is a quite complicated program in it self.

I appriciate some help if possible.

/olle
 
Assuming that the function contains i, then just make the second line of the program result[i=function(par1,par2,etc)[/b]. Then result will be a vector. Unless you change the array origin in Worksheet Options to 1, you should increment from 0 to n-1.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor