Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X
I am currently running Mathcad 15 on Windows XP SP3 which is a 32 bit operating system. A Mathcad 15 worksheet I am running has to do a LOT of number crunching. Mathcad 15.exe is running my CPU usage at 99% and a RAM usage of about 480,000 kB, as well as locking up once in a while requiring a reboot. I already broke the worksheet down into a number of smaller worksheets, got rid of unecessary XY plots, and got a summation of a summation to work the fastest way possible. Also tried decimation to reduce the load on the system, but found I can't use it, since I lose some of the input data when I do that.
My company's MIS department wants to give me a new Windows 7 64 bit machine. But I notice in the Mathcad 15 specifications that it will only run as a 32 bit application on a 64 bit operating system.
So will running a newer PC with Windows 7 64 bit help me any?
Also I notice under system requirements none of the newer CPUs are listed. With what newer CPUs is Mathcad 15 compatible?
Bill
Solved! Go to Solution.
Look a bit more carefully. I snuck in a conversion from linear to db before doing the threshold separation.
Lou
Lou,
Found it.
I really don't understand how you did it, but it appears to me you were able to get a 6:1 improvement in the number of frequencies needed for a plot. And it appears to be accurate as well. Impressive!
What do I change to get other compression ratios?
Thanks, Bill
Basically, I just sorted the amplitudes and selected the largest components, keeping the corresponding frequencies, rather than the full range vectors.Here's a summary outline:
1. Map amplitude to desired scale, whatever you wish, before combining with freq (these should be untouched). In my sheet, the db conversion is inside the line - and apparently not so obvious - where the freq and ampl are augmented into one array. The dbn definition is in in the top function area, and it converts to db and offsets to make the max=0.
2. Sort the 2-col array (freq-amplitude) by the amplitude column to get decreasing amplitudes in col1 with corresponding freq's in col0.
3. Select only that portion of the f-Ampl array with ampl values above a threshold.
4. Separate into f and ampl vectors and plot. Note that these have lengths = # of components above threshold.
No extra values needed, and every value retains its true amplitude(however mapped) with the corresponding freq. This is just extracting the exact subset of freq's that have significant (above threshold) ampl values, and plotting those. Since the freq info is also kept, the plot is x-y accurate, just not every f is plotted, hence the relative efficiency.
Be curious as to how it works on your large vectors (left to the student:-).
Lou
Thanks, Lou.
It sure worked great on the one worksheet I have been working on with a vector of 1,638,400. It reduced the size by 1/6.
I thought of another idea that would help as well. When I do the summation of a summation of the discrete frequency passbands, I don't need to use the entire final vector size. All I have to do for high band 2-way discrete frequencies is just create a vector for that frequency range. Like in my case 150 to 170 MHz. With broadband passbands simulated by discrete frequencies I can do the same.
I can then just add all the sub bands together. But I will have to stack zeros before and after each sub band before the summation to get the vector for the CFFT. Do you know if there is any way to do a CFFT on just the summation of the sub bands? (I doubt it could be done since the Intermod products are on other frequencies.) I am sure I couldn't use a vector, it would have to be a 2 column matrix with frequency and amplitude.
Or maybe I could somehow insert the sub bands into an all xero vector?
Just thinking aloud.
Bill
But I will have to stack zeros before and after each sub band before the summation to get the vector for the CFFT. Do you know if there is any way to do a CFFT on just the summation of the sub bands? (I doubt it could be done since the Intermod products are on other frequencies.) I am sure I couldn't use a vector, it would have to be a 2 column matrix with frequency and amplitude.
Sorry, but you would need to add the zeros. The CFFT does not know anything about the frequency axis.
How about something like this?
I am thinking this might be a lot faster and easier than doing the summation of a summation for all i for a big problem.
That works. Thanks, Richard.
Now how do I plot v versus f?
Whoops, I should have said InsertAmps(v,fa) versus f?
Actually that function puts the frequency at 4,6,8 instead of 40, 60, 80 where the discrete frequencies should be located.
Whoops, I should have said InsertAmps(v,fa) versus f?
Or assign it to another vector and plot that vs f
Actually that function puts the frequency at 4,6,8 instead of 40, 60, 80 where the discrete frequencies should be located.
Frequencies 40, 60, 80 are at indices 4, 6, 8.
Lou,
I am confused about something. In your examples you say for fs, the "desired sampling freq - pick high enough for no aliasing of higher order spectral terms. (fNyquist is 500 with fs = 1000)"
All I care about for results are the fundamental products.
For any order intermodulation there will be the fundamental products, but there will also be products at for example the 3rd harmonic, 5th harmonic, etc. which are at the order of Intermodulation times the frequency of the fundamental products. I know about the Nyquist requirement, but do I need to select that based on only the worst case maximum frequency of the fundamental products or the order of intermodulation times the fundamental frequency harmonics?
All I care about for results are the fundamental products.
Bill
I assume by "fundamental products" you mean the IM products near the fundamental, e.g., for f1=99 and f2 = 101, the 3rd order components at 97 and 103, rather than those at 301 or 303.
The full spectrum includes components at multiples, up to the highest IM order, of 100. while you may be interested only in the fundamental spectral components, the other terms are present, and they will alias if the sampling frewquency is not high enough. The question is whether, in the presence of aliasing, you can pick an fs so that the aliased components are distinct (in frequency location) from the fundamental terms you are interested in. Since you know all of the initial signal frequencies and can calculate the frequencies of all the harmonic/IM terms, you can also calculate where the alaised components will fall. It may be possible to pick an fs so that none of the aliased components will overlap the fundamental conmponents, but that may prove difficult in practice.
One point that may help is that you should also be able to bound the magnitude of the aliased components, and you may not care if the alias bands overlap as long as you know a priori that they will be small enough to ignore.
If the region of interest is the lowest of all the various spectral bands, then you don't need fs greater than twice the highest freq. It is sufficient that fs > highest freq in signal + freq of fundamental band. This will guarantee that any aliased bands remain distinct from the fundamental band. For the example in the first paragraph, fs=450 puts the lowest alias at 450-303 = 147, which is distinct from the components of interest.
Lou
Thanks for the reply, Lou.
I tried varying fs, the sample frequency, for the example we were looking at earlier. But got some strange results. See attached. (The last graph and fs global definition are functional, the rest of the plots with definitions of fs are just bitmaps.) It seems like it is always safe using the highest order harmonic as the highest frequency X 2 for Nyquist. But it doesn't seem to be consistent just using the highest fundamental frequency X 2, or even higher for fs. The example is in Mathcad 11 format.
I would not expect "...just using the highest fundamental frequency X 2, or even higher for fs.." to be consistent. This is not the criterion I stated. Nor does the result with fs=400 "work," as you indicate, since the spectral components in the range f=100-170 are clearly not the same as for f =1000, and have some alias overlap in them.
In your example, the highest freq component in the full signal with distortion is at approx f=375 = 3*125 (=3 x highest "fundamental" component). I assume you are interested inmaintaining integrity of the spectrum up to the "fundamental" IM components, or up to approx f= 170. The best you can do is to pick fs = highest spectral component (any of them , not just fundamental ones) + desired safe band = 375+170 = 545 as per my previous post. If you try this value and compare to fs=1000, you'll see that the spectral components up to f=170 are unchanged (check numerically if you wish), and that you see alias components starting at about f=180, which is above the 170 we used as the safe upper limit.
Lou
Thanks, Lou.
That works great. See attached Mathcad 11 file. Thank you very much.
BTW my "simple idea" of starting in the frequency domain and just inserting vectors ended up going down in flames. It turned out to be far more complicated than I had thought, and it didn't work either. Time has to be included. I tried getting the time domain off of my frequency domain with an ICFFT, but that only produced garbage. (This was an ill fated attempt to eliminate the summation of the summation which was causing memory errors at the time with Mathcad 15 on Windows XP SP3 32 bit.)
I also tried Mathcad 15 on a 64 bit Windows 7 machine. At first it seemed a little more stable, but as I increased the number of points in the problem to about 6.5 Million with up to 9th order Intermodulation I was able to get it to work one day by manually doing an F9 on each succeeding math or graphic region. It took a whole day to do that, though, between "out of memory" errors. But the next day it didn't work at all. So Richard was right. There is very little to no improvement going to a 64 bit Windows 7 machine, when using Mathcad 15 32 bit.
So I called Mathcad Maintenance. I was told to go the link below and that I could use the "/3GB" switch in the boot.ini file to increase the application memory to 3 GB in Windows XP SP3 32 bit. This will not work with Windows 7.
https://www.ptc.com/appserver/cs/view/solution.jsp?n=111330
Title:
Increasing The Per-Process Memory Limit in Windows XP Professional (32-bit) for Pro/ENGINEER, Windchill Workgroup Manager and Web Browser processes via Microsoft's /3GB switch.
All I needed to do was part 1. to get the 3GB of application memory after rebooting and part 3. to go back to normal operation after rebooting. (I did not need to do part 2. the IMAGECFG part.)
I ran into 2 difficulties doing this. The first is it forces you into 640x480 VGA because of the very low amount of memory available for the Windows XP system. And as a result when you are editing the boot.ini file to get back to normal operation, you can not scroll to the right because the scroll bar is off the bottom of the screen. In this case I had to place the cursor in the text line in the boot.ini file and use the arrow keys to move right and delete the /3GB switch. All of this has to be done using the detailed directions in the Solution Details given in the above link. Do not try this on your own!
To get my large Intermodulation project sheet to work with the /3GB switch I also had to break it down into a number of separate worksheets. One each sheet for each provider up to and including the summation of the summation. Then I used WRITEPRN to create prn files at the maximum PRNPRECISION or 16 and a PRNCOLWIDTH of 32. Then of course I used READPRN to retrieve the data in a summary sheet with the nonlinear function, CFFT's, and graphics. I used the submatrix function to limit the number of points to just what I was looking for, so the graphics would work correctly.
Anyway it worked for me, it was very easy to do, and was very reliable. I might have been able to push it higher, but I didn't need to go higher in the number of points or in the order of intermodulation, so I decided to quit while I was ahead. BTW while in this mode I could use the Canon networked printer and I could also use my registered version of PDF995 to print the results Mathcad 15 document to a PDF file with no problem.
So Windows XP SP3 32 bit beats Windows 7 64 bit at least as far as 32 bit Mathcad 15 documents working with a large number of points like 6.5 million go.
I see. I might have a solution for that. Could you post a worksheet with an example vector of data (nothing else is needed, just the data)?
OK here it using Lou's example in Mathcad 11. I just added one single carrier and plotted with and without decimation.
Richard,
I checked things out and the plots look good in frequency, amplitude, and bandwidth (checked when I disabled the extra carrier). Just changing the Ym decimation to 4 also worked fine. See attached file that I used to check things out, against the original Ym which I called Ymo.
This looks like it could be quite useful.
If I had a much larger problem, how would I setup to decimate by say 10, or something like that? Or would I even be able to, if I had discrete frequencies every other point like in the example? It seems to me they would have to be spaced at least every 10 points apart from each other, but I need the resolution as well to see the narrowband carrier frequency differences, and the 3rd order intermodulation produced from those.
Bill
I was only suggesting that you decimate the data for the purposes of plotting over a wide frequency range. In that situation you can't resolve the very fine structure anyway. If you are plotting a narrow frequency range then you should use the raw data, because you will not be plotting very many points anyway.
Bill,
I'm not aware of any way to force Mathcad to use less CPU usage. I'll check and get back to you if I find a solution.
Regards,
Mona
Mathcad Prime 2.0 include support for 64-bit platforms (and leveraging 64-bit memory).
Whoops again, looking at the result, the frequencies should be at 400, 600 and 800.
Just change the first column of fa
Thanks Richard. That should be OK. v versus i is all I need. (It will be x in the intermod analysis.)
I tried doing this a different way shown below. But for some strange reason when I change the name of v to z in the relation, the range variable i is limited to 800 instead of the 1000 as it should be. Just out of curiousity can someone explain this? I have seen this sort of thing happen with range variables in the past.