Dear All,
Could someone please explain the correct way to feed a arbitrary waveform data to the 33250A. To explain vividly, I have given a sample matlab code here through which I dumped a waveform data to a Text file and then fed it to the generator using Agilent waveform editor.
"%%%%%%%
x=linspace(0,2*pi,4*1024);
a = cos(50e3*x);
m=max(a);
a = a/m;
plot(a);
grid on;
fp = fopen('C:\Documents and Settings\Administrator\Desktop\lokesh\feedInput.txt','w');
fprintf(fp,'%f \n',a(1:4*1024-1));
fclose(fp);
"
Question:
1)As you see in the above program, I'm planning to feed a 4K point waveform data to the waveform generator. Is the way in which I have broken the points in X-axis correct?.(x=linspace(0,2*pi,4*1024+1))
2)Do note that when dumping the points to a text file, I'm taking only "0 to n-1 points" instead of "0 to n". Is it correct?
Regards,
lokesh
Could someone please explain the correct way to feed a arbitrary waveform data to the 33250A. To explain vividly, I have given a sample matlab code here through which I dumped a waveform data to a Text file and then fed it to the generator using Agilent waveform editor.
"%%%%%%%
x=linspace(0,2*pi,4*1024);
a = cos(50e3*x);
m=max(a);
a = a/m;
plot(a);
grid on;
fp = fopen('C:\Documents and Settings\Administrator\Desktop\lokesh\feedInput.txt','w');
fprintf(fp,'%f \n',a(1:4*1024-1));
fclose(fp);
"
Question:
1)As you see in the above program, I'm planning to feed a 4K point waveform data to the waveform generator. Is the way in which I have broken the points in X-axis correct?.(x=linspace(0,2*pi,4*1024+1))
2)Do note that when dumping the points to a text file, I'm taking only "0 to n-1 points" instead of "0 to n". Is it correct?
Regards,
lokesh
Yes, generating a linear sampling of points over the waveform is the best practice. Above you mention (x=linspace(0,2*pi,4*1024+1)) while in your sample Matlab code you use (x=linspace(0,2*pi,4*1024)). I would think the latter is what you are meaning to use. (x=linspace(0,2*pi,4*1024)) generates a row vector of 4*1024 points (4096 points) linearly spaced between and including 0 and 2*pi.
Again there is a discrepancy between what you type in your question and what is in the code. Since the subscript indices for your matrix "a" must be positive integers (they start at 1), you will want to take points "1 to n". Point 0 does not exist. In your code you type "a(1:4*1024-1)" this is only 4095 points. I am assuming you are looking to have 4096 points which would be accomplished with "a(1:4*1024)" .
The code works overall just be careful of sending the correct points and the correct number of points to your text file. You may also be interested to know that you can send your Matlab generated arb directly to the 33250A without creating a text file and loading that onto IntuiLink Waveform Editor first. The link below will take you to an example of how to do this posted on this forum.
view topic
Thanks!
Mueller