Smoothing/Filtering the Real-Time Signal with Sliding Window - matlab

I am taking the datas from my sensor and the datas are the multiples of 5.8594 so my whole data looks like a mix of square wave and ramp function. What I want is, smooth the corners of this data with for loop. I want to see exponential-like or sinusoidal-like signal while iterating. I can do it with whole data but can not do it with for loop.
Thank you for your suggestions.
enter image description here
I tried low pass filtering to whole data and it works. But with windowing and real time processing, it is not applicable with this level of order.

Related

MATLAB data tips - better accuracy

G'day,
Have been provided a p-code MATLAB program to find data tips from a graph. Attached is an image of a step response of unknown magnitude of a water tank system.
For better accuracy, I would like to extract data at discrete intervals instead of zooming in and attempting to click on a whole number. Is there a way of doing this through the graph/data tips, without writing code.
Is this even possible with a graph received from a P-code? or will I have to just average out multiple attempts.
Cheers

Custom trapezoidal function in matlab

I want to create a trapezoidal-like function in Matlab that will repeat not only for one or two periods, but for the duration of the simulation. Also, I want to control every value of the basic pulse, like the maximum value (in the picture attached it is 10000), how quickly it rises to maximum, how long it stays at maximum, and at zero. I have attached a picture of the main pulse. I have previously used a trigonometric function
Fn=((a/pi)*(asin(sin((2*pi/m)*t+l))+acos(cos((2*pi/m)*t+l)))-a/2+c)
but I cannot control all the above characteristics and therefore its not representative of what i want to do.
Picture of what I have currently
Thanks for the help in advance.

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.

Binning/averaging data in Matlab

I'm currently trying to solve this; I have an idea of how to do this, but I would really appreciate any extra input I could get.
I need to come up with a Binning function that takes in raw thickness data from a trace file, that is read in by another function. I need to put this data in 5mm bins. The tricky part will be to smooth fit the curves at both ends, and also perform data validation of the input data.
In summary: I need to take data values and "bin"/average them in 5mm intervals.
Thanks guys.
It sounds like you want the hist() function, which creates a histogram by binning the input data.

How to play a row of numbers on an iPhone as audio?

I'm looking at an output of an electroencephalogram sensor. This data is displayed on screen in raw form at about 200Hz. I read that in the old times, it was possible to hook up such output to a speaker and hear the waveform, instead of seeing it. So I'm interested if it is possible to replicate this experiment with modern iPhone. How can I take a waveform that is displayed in a graph form and package it in such a way that it can be played through a iPhone's speakers live? In other words, I'm looking to stream EEG data through some sort of audio player and need to know how to create audio packets from this data on the fly.
Here's the raw waveform, it is displayed at 200 data points per second (200Hz)
After I clean up and process the waveform, I'm interested in how far it deviates from the average of the waveform. In this case, I think this can be played as a increasing/decreasing amplitude of a sine wave, which may be easier.
Thank you for your input
Here's a good tutorial on generating a sine tone for output through CoreAudio:
http://www.cocoawithlove.com/2010/10/ios-tone-generator-introduction-to.html
The RenderProc is the bit of code you're twiddling with, in the example they're using an NSSlider to change the frequency, you just need to feed it with your signal data instead.
One of the ideas that I had for playing sound in response to the signal amplitude change is to divide the amplitude into a set of discrete bands of values (for example 0-10, 10-20, 20-30, etc) and then assign a sound to each band. Then using audio services or system sound, it might be possible to loop a unique sound fragment for each band.