1 | % ---------------------------------------------------------------------- |
---|

2 | % MAIN PROGRAM - generated by the Rappture Builder |
---|

3 | % ---------------------------------------------------------------------- |
---|

4 | |
---|

5 | % open the XML file containing the run parameters |
---|

6 | % the file name comes in from the command-line via variable 'infile' |
---|

7 | io = rpLib(infile); |
---|

8 | |
---|

9 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|

10 | % Get input values from Rappture |
---|

11 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|

12 | |
---|

13 | % get input value for input.number(n1) |
---|

14 | n1 = rpLibGetDouble(io,'input.number(n1).current'); |
---|

15 | |
---|

16 | % get input value for input.number(n2) |
---|

17 | n2 = rpLibGetDouble(io,'input.number(n2).current'); |
---|

18 | |
---|

19 | % get input value for input.number(n3) |
---|

20 | n3 = rpLibGetDouble(io,'input.number(n3).current'); |
---|

21 | |
---|

22 | |
---|

23 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|

24 | % Add your code here for the main body of your program |
---|

25 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|

26 | t = linspace(0, 1, 1000); |
---|

27 | z = exp(i*2*pi*n1*t) + exp(i*2*pi*n2*t) + exp(i*2*pi*n3*t); |
---|

28 | |
---|

29 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|

30 | % Save output values back to Rappture |
---|

31 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|

32 | |
---|

33 | % save output value for output.curve(z) |
---|

34 | % this assumes a vector 'x' and a vector 'y' |
---|

35 | xydata = [real(z);imag(z)]; |
---|

36 | str = sprintf('%12g %12g\n', xydata); |
---|

37 | rpLibPutString(io,'output.curve(z).component.xy',str,0); |
---|

38 | |
---|

39 | |
---|

40 | rpLibResult(io); |
---|

41 | quit; |
---|