I implemented code to get orientation estimation with accelerator, gyroscope, and magnetometer using Madgwick AHRS algorithm.
I guess it worked out well. However, in some range of the data, result values under -180° have a problem: values are "lifted up." I couldn't find the right words for this, so I attached the figure below. I looked into the code but did not get any clue how to fix this problem. I followed the sample code given by the repository here(Matlab code zip file). I want to know how to resolve this issue. Thank you in advance!
I really appreciate your help #AnderBiguri and #Daniel! Sorry for my late reply.
unwrap function worked beautifully. This gave me inner peace of my mind.
Before unwrap:
After unwrap:
Related
I'm trying very hard to understand this code about a Deep Learning-Based NOMA system based in MATLAB. I am really new to MATLAB coding but I really need to understand this entire code as it will help in my school project and I am struggling.
I think as of right now I do not need to know how the mathematical formulas work, but instead, the focus is on what the code is doing and its flow.
This is part of the code in the trainData.m file that I am struggling with right now
Why are the pilot symbols calculated and then replaced right after?
Why is the idx_sc (20) selected to be replaced? What is its significance? Is it the only subcarrier selected for the training of the DL model? Why only that?
This portion of the code in the picture is labeled "generate training data for each class". From my understanding, it is generating OFDM packets for each label, simulating the transmission and reception, and then getting the features and labels for each of the 16 classes. Is that correct?
The code and all relevant function files can be found in the link below.
Please help me understand the code!!! Please! Much thanks!
https://www.mathworks.com/matlabcentral/fileexchange/75478-deep-learning-for-signal-detection-in-noma-systems
To get you started, In lines 91 the code initializes the entire variable as 0. Subsequent lines (92-96) are just replacing pieces of the variable based on the indexing inside the “(…)”
I am new to the Neuroscience topic and I am supposed to baseline correct some EEG data that I have already epoched. I have been googling to try to find out how to do this on Matlab but I am not sure what the concept is. Can anyone help? I know it's a very general question but I am not sure what to ask. If someone can point me in the right direction or even tell me how to do it, I'd be very thankful.
You have to subtract the mean of the first samples of every channel from the whole length of the channel. Typically the baseline window is 100ms or more before the event.
I try to program the Bridson’s algorithm for Poisson-disc sampling on scratch, it seams to be some side effect or a bug I can't find. Could you help me ?
Here is my try : My try online.
Some explanation on the algorithm.
Found the bug.
The answer is on the same link as in the question.
Thank you.
Nothing important, an obvious mismatch in indexes.
Sorry about this noob question, because I never work with matlab and signal processing before.
Here is what I want to do: I have a fixed length of byte array X, now I want to encode it to a sound file, I also want this process to be reversible, which means the sound can be converted back to X with no error. I searched online, and found the following code:
M = 16;
x = randint(5000,1,M);
y=modulate(modem.qammod(M),x);
My question is that, is QAM the best way to do this? and how to use it? A little bit code example will be really appreciated, Thank you!
update#1: I tried to output y by sound(y), but matlab does not allow me to do so, it says I can only output floating numbers. How can I solve this? Thank you!
If you need to transmit over the air, you have quiet a lot of work in front of you I think. The most difficult problem to solve in a telecommunications system is often synchronization, meaning that your receiver will have to know where the QAM symbols are placed in time. This is not easy. If you choose to go ahead I agree with mtrw that you should try dsp.stackexchange.com.
Try for example to imaging a simple modulation scheme where each bit is converted to a short piece of sine with the frequency depending on whether the bit is one or zero. How would you go about decoding this on the receiver end? You need to detect the onset of the first bit and have some self maintaining clock running for synchronization on the receiver to find bits in case they do not change, aka a PLL (Phase Locked Loop). This could possibly be made easier by using manchester coding, but you would still have to do quite a lot to get it running.
As you see, there are no easy solutions when you leave the save Matlab harbor :-)
Best regards
For a project i am supposed to write my own function that will do the same thing as the magic function in matlab. I am obviously not asking anyone to write out my problem but if somebody could give me any ideas of how i could start it or example code it would be much appreciated! I am completely lost on how to start this one...
This is often great advice:
If a problem is too hard, try solving an easier one to begin with.
Try to write code to generate a 2 by 2 magic square? Then try 3 by 3. Then 4 by 4. Can you see how to generalise?
I guess you already thought about it, but the usual good source of information is wikipedia:
https://en.wikipedia.org/wiki/Magic_square#Types_and_construction
It explains different ways of making magic squares.