I’m trying to do signal process with julia, and I’m new in language. I m having trouble with language to generate a simple signal(i came from matlab and octave). May someone help?
using Plots
frequency = 3
x = range(0, stop = 100, step = 1)
y = sin.(2π * x * frequency)
plot(x, y, lw = 3)
Hello. The sample rate was wrong. I was mususing the range function, and got confused with another matlab function linspace, that you pass the number of points in signal resolution. This range works as counter part of linspace.
using Plots
frequency = 3
sample_rate = 100
x = range(0, stop = 1, step = 1/sample_rate)
y = sin.(2π * x * frequency)
plot(x, y, lw = 3)
Im very new to julia. Did not know about that. Seems is similar to linspace. I had a trouble even with sin function. I need to search a lot to understand that sin just dont vectorize without the dot “.”.
But, I’m enjoining a lot plot data in julia. Its way faster than python, scilab or octave. The svg aproach permits good performance with high resolution signals. I can zoom between withou any lag.
range(0, 1, 100) is the same as MATLAB’s linspace(0, 1, 100) but is way more efficient (doesn’t allocate a vector of 100 elements) and more accurate (TwicePrecision).