Bridson’s algorithm for Poisson-disc sampling on Scratch - mit-scratch

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.

Related

Solving a problem with constant objective in Worhp faster

I have a problem in Worhp with a constant objective. For this particular problem, it is only relevant to minimise the constraint violations.
Worhp indeed finishes the optimisation with the message "Optimal Solution Found (objective appears to be constant)”.
My question is: is there a way to tell Worhp up front that the objective function is constant, so it can be more efficient (faster) in finding the solution? Are there parameters in the worhp.xml that I can adjust to solve the problem faster?
I just found an answer to my own question. The FeasibleOnly parameter instructs Worhp to stop the optimisation once a feasible point is found.
A classical case of RTFM.... sorry!

Problem in result value lesser than -180° from Madgwick AHRS

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:

Is QAM the best way to do this?

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

Magic Square Function Matlab

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.

Estimating effort to port code from Matlab to Octave

I just read a fascinating paper: http://www.psy.cmu.edu/~ckemp/Papers/kempt08.pdf
In my opinion it takes the whole area of machine learning to a completely new level because it flexibly discovers the structure of data (and doesn't only try to find a best fit for an existing structure).
The code is also available: http://www.psy.cmu.edu/~ckemp/code/formdiscovery.html
I tried to do a few experiments of my own - but unfortunately I don't possess Matlab. I tried it with Octave but it only produced all kinds of error messages, which I don't understand (I am no expert on these programs).
Could anybody perhaps have a quick look if these problems can be solved easily (or at all)? Perhaps the solution will be an easy one (this is my hope after all).
This would really be a big help! I am very much looking forward to trying a few data sets of my own.
I didn't look into the source code, but if you are going to convert it, these links might help:
Porting programs from Matlab to Octave
Differences between Octave and MATLAB
I was recently looking for an answer to the same question and found this old post. Just to add my two cents for anyone else looking...
There is an Octave library called Missing Function Library that "Finds functions that are in Matlab but not in Octave". Also, there are a bunch of great packages (read "Toolboxes") for Octave as well on SourceForge. Hope this helps!