Difference between revisions of "User-Supplied Plain Text Function Formats"
(Created page with "Rave can load simple "plain text" functions that meet the following criteria: *The function calculates a single output variable. It may have any number of input variables. *...") |
|||
Line 8: | Line 8: | ||
Rave can load plain text functions either from a .txt file, or you can type/paste them into a dialog box. In either case, the content of the function should be only the right hand side of the equals sign. For example, if you have the function y = x1 + x2, you would use only "x1+x2" as the content of the function. You will supply the name of the output variable when you load the function into Rave. | Rave can load plain text functions either from a .txt file, or you can type/paste them into a dialog box. In either case, the content of the function should be only the right hand side of the equals sign. For example, if you have the function y = x1 + x2, you would use only "x1+x2" as the content of the function. You will supply the name of the output variable when you load the function into Rave. | ||
− | *Tip: If you are loading a function stored in a .txt file, Rave will suggest the file name as the default variable name. So you can save time by using the functional variable's names as your file names. | + | *Tip: If you are loading a function stored in a .txt file, Rave will suggest the file name as the default variable name. So you can save time by using the [[functional variable]]'s names as your file names. |
*Developer tip: The function that Rave uses to convert plain text files to .m files is named ravetxt2m.m | *Developer tip: The function that Rave uses to convert plain text files to .m files is named ravetxt2m.m | ||
Line 22: | Line 22: | ||
exp(11.6703935+Thrust*-0.0000326600101+FPR*-1.41803275+LPCPR*0.00415193051+OPR*-0.0029531291+T4max*-0.000195797154+Vratio*-1.92648403+Loading*0.360255868+Payload*0.0000284530331+Range2*0.000163181712+Thrust*Thrust*0.000000000606111453+FPR*Thrust*-0.00000438394509+FPR*FPR.*0.508561336+LPCPR*Thrust*-0.000000658367223+LPCPR*FPR*-0.0092802591+LPCPR*LPCPR*0.0160130278+OPR*Thrust*0.00000000140482047+OPR*FPR.*0.000770681078+OPR*LPCPR*0.0000346999344+OPR*OPR*0.0000202874834+T4max*Thrust*-0.00000000212251231+T4max*FPR*-0.0000692665696+T4max*LPCPR*0.000036486005+T4max*OPR*-0.00000109566933+T4max*T4max*0.0000000544769111+Vratio*Thrust*-0.000000980437888+Vratio*FPR*-0.0132480486+Vratio*LPCPR*-0.0825760778+Vratio*OPR.*0.00185308179+Vratio*T4max*-0.0000103482963+Vratio*Vratio*0.570256604+Loading*Thrust*0.000000941943684+Loading*FPR*-0.0350705609+Loading*LPCPR*-0.0595044256+Loading*OPR*0.00249845651+Loading*T4max*-0.0000518362764+Loading*Vratio*-0.00857311658+Loading*Loading*-0.0755155667+Payload*Thrust*-0.000000000179474291+Payload*FPR*-0.00000118332246+Payload*LPCPR*-0.000000114138247+Payload*OPR*-0.00000000578049718+Payload*T4max*0.000000000171659028+Payload*Vratio*0.000000279097022+Payload*Loading*-0.000000166412116+Payload*Payload*-0.0000000000599337645+Range2*Thrust*-0.000000000837792856+Range2*FPR*0.0000218442552+Range2*LPCPR*-0.000000383165627+Range2*OPR*-0.000000264719975+Range2*T4max*-0.0000000167869449+Range2*Vratio*0.0000190871404+Range2*Loading*0.000000714906327+Range2*Payload*-0.000000000182036483+Range2*Range2*-0.000000000321241661) | exp(11.6703935+Thrust*-0.0000326600101+FPR*-1.41803275+LPCPR*0.00415193051+OPR*-0.0029531291+T4max*-0.000195797154+Vratio*-1.92648403+Loading*0.360255868+Payload*0.0000284530331+Range2*0.000163181712+Thrust*Thrust*0.000000000606111453+FPR*Thrust*-0.00000438394509+FPR*FPR.*0.508561336+LPCPR*Thrust*-0.000000658367223+LPCPR*FPR*-0.0092802591+LPCPR*LPCPR*0.0160130278+OPR*Thrust*0.00000000140482047+OPR*FPR.*0.000770681078+OPR*LPCPR*0.0000346999344+OPR*OPR*0.0000202874834+T4max*Thrust*-0.00000000212251231+T4max*FPR*-0.0000692665696+T4max*LPCPR*0.000036486005+T4max*OPR*-0.00000109566933+T4max*T4max*0.0000000544769111+Vratio*Thrust*-0.000000980437888+Vratio*FPR*-0.0132480486+Vratio*LPCPR*-0.0825760778+Vratio*OPR.*0.00185308179+Vratio*T4max*-0.0000103482963+Vratio*Vratio*0.570256604+Loading*Thrust*0.000000941943684+Loading*FPR*-0.0350705609+Loading*LPCPR*-0.0595044256+Loading*OPR*0.00249845651+Loading*T4max*-0.0000518362764+Loading*Vratio*-0.00857311658+Loading*Loading*-0.0755155667+Payload*Thrust*-0.000000000179474291+Payload*FPR*-0.00000118332246+Payload*LPCPR*-0.000000114138247+Payload*OPR*-0.00000000578049718+Payload*T4max*0.000000000171659028+Payload*Vratio*0.000000279097022+Payload*Loading*-0.000000166412116+Payload*Payload*-0.0000000000599337645+Range2*Thrust*-0.000000000837792856+Range2*FPR*0.0000218442552+Range2*LPCPR*-0.000000383165627+Range2*OPR*-0.000000264719975+Range2*T4max*-0.0000000167869449+Range2*Vratio*0.0000190871404+Range2*Loading*0.000000714906327+Range2*Payload*-0.000000000182036483+Range2*Range2*-0.000000000321241661) | ||
</pre> | </pre> | ||
+ | |||
+ | |||
+ | ==Function files created by Rave== | ||
+ | Whenever you load a plain text function, Rave creates a .m function that it calls in place of the function you supplied. Rave does not use the original .txt file you supplied after the initial creation of this function. Any subsequent changes you make to the .txt file will have no effect in Rave. If you need to change the function you will have to directly modify the .m function. | ||
+ | |||
+ | Rave places the .m file it creates in your [[default directory]]. It's ok to move it to a different directory as long as you keep it on your [[MATLAB search path]]. |
Latest revision as of 16:11, 23 August 2013
Rave can load simple "plain text" functions that meet the following criteria:
- The function calculates a single output variable. It may have any number of input variables.
- The function involves only basic math operators: + - * / ^ abs(), sin(), cos(), log() etc...
- The function can theoretically be represented as a single statement (line) of MATLAB code. I.e. it cannot involve "if" statements, "for" loops etc.
- The names of all input variables are legal matlab variable names. This generally means they must begin with a letter and cannot contain symbols (other than _) or spaces.
Rave can load plain text functions either from a .txt file, or you can type/paste them into a dialog box. In either case, the content of the function should be only the right hand side of the equals sign. For example, if you have the function y = x1 + x2, you would use only "x1+x2" as the content of the function. You will supply the name of the output variable when you load the function into Rave.
- Tip: If you are loading a function stored in a .txt file, Rave will suggest the file name as the default variable name. So you can save time by using the functional variable's names as your file names.
- Developer tip: The function that Rave uses to convert plain text files to .m files is named ravetxt2m.m
Examples: A simple function may look like:
x1 + cos(x2) * abs(x1/x2) - exp(x) + x^2
A more complicated function could be:
exp(11.6703935+Thrust*-0.0000326600101+FPR*-1.41803275+LPCPR*0.00415193051+OPR*-0.0029531291+T4max*-0.000195797154+Vratio*-1.92648403+Loading*0.360255868+Payload*0.0000284530331+Range2*0.000163181712+Thrust*Thrust*0.000000000606111453+FPR*Thrust*-0.00000438394509+FPR*FPR.*0.508561336+LPCPR*Thrust*-0.000000658367223+LPCPR*FPR*-0.0092802591+LPCPR*LPCPR*0.0160130278+OPR*Thrust*0.00000000140482047+OPR*FPR.*0.000770681078+OPR*LPCPR*0.0000346999344+OPR*OPR*0.0000202874834+T4max*Thrust*-0.00000000212251231+T4max*FPR*-0.0000692665696+T4max*LPCPR*0.000036486005+T4max*OPR*-0.00000109566933+T4max*T4max*0.0000000544769111+Vratio*Thrust*-0.000000980437888+Vratio*FPR*-0.0132480486+Vratio*LPCPR*-0.0825760778+Vratio*OPR.*0.00185308179+Vratio*T4max*-0.0000103482963+Vratio*Vratio*0.570256604+Loading*Thrust*0.000000941943684+Loading*FPR*-0.0350705609+Loading*LPCPR*-0.0595044256+Loading*OPR*0.00249845651+Loading*T4max*-0.0000518362764+Loading*Vratio*-0.00857311658+Loading*Loading*-0.0755155667+Payload*Thrust*-0.000000000179474291+Payload*FPR*-0.00000118332246+Payload*LPCPR*-0.000000114138247+Payload*OPR*-0.00000000578049718+Payload*T4max*0.000000000171659028+Payload*Vratio*0.000000279097022+Payload*Loading*-0.000000166412116+Payload*Payload*-0.0000000000599337645+Range2*Thrust*-0.000000000837792856+Range2*FPR*0.0000218442552+Range2*LPCPR*-0.000000383165627+Range2*OPR*-0.000000264719975+Range2*T4max*-0.0000000167869449+Range2*Vratio*0.0000190871404+Range2*Loading*0.000000714906327+Range2*Payload*-0.000000000182036483+Range2*Range2*-0.000000000321241661)
Function files created by Rave
Whenever you load a plain text function, Rave creates a .m function that it calls in place of the function you supplied. Rave does not use the original .txt file you supplied after the initial creation of this function. Any subsequent changes you make to the .txt file will have no effect in Rave. If you need to change the function you will have to directly modify the .m function.
Rave places the .m file it creates in your default directory. It's ok to move it to a different directory as long as you keep it on your MATLAB search path.