Hi everyboy
i'm new to Matlab and i wanted to write a script to read trace from a spectrum analyzer.
I have the algorithm but i dont know how to traduce it in matlab language:
Algorithm script
Input: ip address, f start, f stop, t start, t stop, file name, nof traces per file
Output: power file, time file, frequency file
1: Establish communication with the spectrum analyzer → ip address
2: Send configuration to the spectrum analyzer → ip address
{Including f start, f stop, Table 1 and others}
3: file counter ← 0
4: trace counter ← 0
5: power matrix ← [ ] {Empty}
6: time matrix ← [ ] {Empty}
7: frequency vector ← Set of 551 frequency points between f start and f stop
8: while current time < t start do
9: Nothing {Wait for t start}
10: end while
11: while current time < t stop do
12: t ← current time
13: Initiate new sweep → ip address
14: while Performing sweep ← ip address do
15: Nothing {Wait for the sweep to be completed}
16: end while
17: Retrieve sweep data ← ip address
18: power values ← Retrieved sweep data
19: power matrix ← [power matrix ; power values]
20: time matrix ← [time matrix ; t ]
21: trace counter ← trace counter + 1
22: if trace counter == nof traces per file then
23: file counter ← file counter + 1
24: Save file power file(file counter ) ← power matrix
25: Save file time file(file counter ) ← time matrix
26: trace counter ← 0
27: power matrix ← [ ] {Empty}
28: time matrix ← [ ] {Empty}
29: end if
30: end while
31: if trace counter > 0 then
32: file counter ← file counter + 1
33: Save file power file(file counter ) ← power matrix
34: Save file time file(file counter ) ← time matrix
35: end if
36: Save file frequency file ← frequency vector
37: Close communication with the spectrum analyzer → ip address
Can anybody help?
I appreciate it a lot
Thanks
Hello pozdrowskim,
Here are some links that will be able to help you with what you are doing:
1. Here is a link that has several examples of different ways to write SCPI commands using Matlab
2. This next link shows all the possible SCPI commands that you can use with your instrument
3. I believe the rest of the syntax work can be figured out by looking through the Matlab's documentation in the Mathworks website.
Best of luck!