Paraview IntegrateVariables and Plot Selection Over Time - paraview

I am using the IntegrateVariables filter in Paraview to integrate an energy density rho over a cylindrical volume (obtained using the Clip filter). I need to plot this integrated rho over time, which should be possible using 'Plot Selection Over Time'. However, I can't find a way of applying the filter to the right variable and when I press Apply, Paraview just buffers until I force quit. Can anyone help?

There is no way to specify to a PlotXXX filter which array to process.
But there is the 'PassArray' filter which allows to extract the arrays you want, limiting the computation and the memory consumption.

Related

How to apply a running window to a simulink signal using embedded matlab function?

I want to apply a moving window to the signal of my Simulink model using embedded Matlab function. But whenever I try to divide the signal in time frames, it is always showing to have 1 element. Please suggest how to apply a running window to such signals.
Using a MATLAB function block might not be the best choice. Here is a simple implementation of a moving average filter. Add, Sin and Noise on the left generate an example signal. The mux in the centre is used to insert the new element. The Variable Selector is used to drop the oldest element. In my case I used a workspace variable N for the window size. When really using this I recommend to wrap everything into a subsystem and make it a mask parameter.

Comparison of set of signals

I have certain movement data acquired from motion capture system which I want to automatically choose which 5 signals are more alike.
Picture shows example of the particular data, all normalized to 100 samples due to the difference in speed.
Data set for knee flexion/extension
What I am looking for is some idea to actually compare the shapes of the curves.
The easiest solution is just to substract the "raw" curves and check which one has the smallest RMSE.
But looking at your data (which are smooth curves), another option is to use PLS or GMM to describe them. Then you can use RMSE to compute the error between your input curve and your database of curves and take the one with lowest error.

How to reduce size of printed eps when plotting large amounts of data

I am Plotting and printing a large dataset to eps:
plot(Voltage,Torque,'b.')
print -depsc figure.eps
Through these million data points I will fit a graph. However since the sizes of the Voltage and Torque vectors are enormous my eps file is 64.5 MB.
Most of the plotted points however lie on top of other points or very close. How can I reduce the size of the .eps while still having limited effects on the way the data is shown in the graph? Can I make matlab detect and remove data points close enough to other already plotted points?
although it is a scatter plot, I am not using scatterplot since all points should have the same size and color. Is it possible to use scatterplot to remove visual obsolete datapoints?
Beyond stackoverflow, the File Exchange is always a good place to start the search for a solution.
In this case I found the following submissions:
Plot (Big):
This simple tool intercepts data going into a plot and reduces it to the smallest possible set that looks identical given the number of pixels available on the screen.
DSPLOT:
This version of "plot" will allow you to visualize data that has very large number of elements. Plotting large data set makes your graphics sluggish, but most times you don't need all of the information displayed in the plot.
If you end up using the plot in a LaTeX-file, you should consider using
matlab2tikz:
This is matlab2tikz, a MATLAB(R) script for converting MATLAB figures into native TikZ/Pgfplots figures.
For use in LaTeX you don't have to go the detour of PostScript and it will make for beautiful plots.
It also provides a function called: CLEANFIGURE('minimumPointsDistance', DOUBLE,...), that will help you reduce the data points. (Possibly you could also combine this with the above solutions.)
If your vector Voltage is already sorted and more or less regularly spaced, you can simply plot a fraction of the data:
plot(Voltage(1:step:end),Torque(1:step:end),'b.')
with step set to find the right tradeoff between accuracy and size of your eps file.
If needed, first sort your vectors with:
[Voltage,I] = sort(Voltage);
Torque = Torque(I);

Notch or Bandstop filter and preparing data for it

I am new to matlab and signal processing methods, but i am trying to use its filter properties over a set of data I have. I have a collection of amplitude values obtained at different timestamps. When this is plotted, I get a waveform with several peaks that I can identify. I then perform calculations to derive the time between each consecutive peak and I want to eliminate the rates that are around the range of 48-52peaks per second.
What would be the correct way to go about processing this data step by step? Would a bandstop or notch filter be better if I want to eliminate those frequencies and not attenuate it simply? I am completely lost in the parameters required to feed into the filters for this. Please help...
periodogram is OK, but I would suggest using pwelch instead. It makes a more reasonable PSD estimate and the default parameters are well thought out (Hann windows, 50% overlap of segments, etc.)
If what you want is to remove signals in a wide band (e.g. 48-52 Hz) equally, rather than a single and unchanging frequency, than a bandstop filter is ideal. For example:
fs = 2048;
y = rand(fs*8, 1);
[b,a] = ellip(4, 2, 40, [46 54]/(fs/2));
yy = filter(b,a,y);
This will use a 4th order elliptic bandstop filter to filter the random data variable 'y'. filtfilt.m is also a nice function; it applies the filter forwards and backwards so you get twice the filter action and none of the phase lag or dispersion.
I am currently doing something similar to what you are doing.
I am processing a lot of signals from the Inertial Measurement Unit and motor drives. They all are asynchronously obtained, i.e. they all have very different timestamp and also very different acquisition frequency.
First thing I did was to interpolate all signals data in order to have all signals with same timestamp. You can use the matlab function interp to do this.
After this, you will have all signals with same sample frequency and also timestamp, which will be good in further analysis.
Ok, another thing you can do to analyse the frequency of the peaks is to perform the fourier transform. For beginners i advice the use of periodogram function and not the fft function.
Imagine you signal is x and your sample frequency (after interpolation) is Fs.
You can now use the function periodogram available in matlab like this:
[P,f] = periodogram(x,[],[length(t)],Fs);
This will give the power vs frequency of your signal. After that you will be able to plot and take a look at the frequencies of your signal. In other words, you be able to see the frequencies of the signals that make your acquired signal.
Plot the data this way:
plot(f,P); or semilogy(f,P);
The second is the same thing as the first, but with a logarithmic scale.
After this analysis you can use the Filter Desing and Analysis Tool to design you filter. Just type fdatool in matlab and it will open the design window. Choose the filter type, the cut and pass frequencies and click in design. This tool is very intuitive.
After designing you can export the filter to workspace.
Finally you can use the filter you designed in your signal to see if its what you wanted.
Use the functions filter os filtfilt for this.
Search in the web of the matlab help for the functions I wrote to get more details.
There are a lot of examples availables too.
I hope I could help you.
Good luck.

Matlab Simulink VI graph plotting

Respected,
I plotted the graph between time and current by taking values from electric load using Simulink model in matlab. Now i want to plot the graph between voltage and current that is known as VI curve.so now the problem is the axis. So kindly tell me how can i change the X axis scale of time into voltage scale.thanks.
Regards
Abbas Tausif
From your question it is not very clear how your are acquiring your data, thus my answer can only be so detailed.
This is how I would solve this problem:
In simulink use a clock connected to a "To Workspace" block to record record time.
Use another "To Workspace" block to record the load (I'm not sure if you mean power or impedance here).
set format of both "To Workspace" blocks to array.
After running the simulation you will have two variables in MATLAB (time and load), then using V=IR or P=IV you can work out arrays for voltage and current.
Finally you can plot a graph using the arrays you calculated for V and I in MATLAB using plot(time,current) or plot(voltage,current) ect...
I hope this helps.