### Matlab Code to Generate LoRa Symbols

In the previous post you read the theory about LoRa Symbol generation.

Pay just \$10 Dollars and buy the Matlab codes to generate LoRa Symbols.

Buy the Matlab codes here!

Code generates the following plot.

For theory please refer to  LoRa Symbol generation

1. Dear Sir,
In your LoRa modulation function code, the frequency varies linearly with time. Shouldn't the phase increase be a quadratic function of time, since the total phase is the integral of frequency? I'm very confused since your expression is not even a function of time. It would help me understand LoRa much better if you could clarify this point, Sir.
Thank you in advance!

1. See, I divided the time in small time bins. You know, you can calculate the the symbol time by SF and BW. You can't see the 'time' variable in the code. See, you divided the complete symbol in some number of samples. Number of samples is related to SF and BW, therefore as the sample number increases you move along with both time and frequency axis.

2. 3. I have multiple questions on this plot
1. Why is the plot at 500KHz when you only use BW, SF, Sampling rate in the code
2. what does frequency offset away from DC means?
3. How did you derive equation of number of samples from SF, BW, Fs?
4. Why is Fs = 1MSPS? is it lora standard?

1. Why is the plot at 500kHz? I see in the LoRa function: Frequency_Offset = (Fs/2) - (BW/2);

This calculation gives about 500kHz. But I think it should be the actual carrier frequency like 868MHz?

2. Why is the plot at 500kHz? I see in the LoRa function: Frequency_Offset = (Fs/2) - (BW/2);

This calculation gives about 500kHz. But I think it should be the actual carrier frequency like 868MHz?

3. If you want the central frequency to be 868MHz then you don't need to choose Frequency_Offset = (Fs/2) - (BW/2); In the above code it is 500KHz so that you can visualise the symbols clearly in the graph.

4. Can we directly put 868MHz instead of Frequency_Offset = (Fs/2) - (BW/2); in a code?

4. This comment has been removed by the author.

5. I would like to ask why you set the number of samples like the following num_samples = Fs*(2^SF)/BW? I know that the symbol time is Ts=(2^SF)/BW

6. i developed a matlab code to simulate lorawan throughput by using one gateway, any body can help to provide code of more than gateway in one network to make comparison

7. This comment has been removed by the author.

8. Dear Sir,
In your LoRa modulation function code, I think the " phase = phase + 2*pi*f/Fs;" should be changed to "phase = phase + 2*pi*f/Fs+pi*(BW*BW/Fs/Fs/2^SF);".
Thank you in advance!

1. unless f0=0.5*BW^2/2^SF/Fs. Right?

9. Hi the variable symbol is any integer number our is it a bit been 1 or 0?

10. I am working on LoRa -modulation based communication . Kindly send me the matlab codes