hi , i want to create a user interface in which the user will enter the sampling rate and the frequency, the interface will plot the sine wave when pressed on a button accordingly using chart series. simply what im trying to do is this code when written on matlab, 1 fs= 96000; 2 f= 1000; 3 nCyl=1; 4 t=0:1/fs:nCyl*1/f; 5 x=sin(2*pi*f*t); 6 plot(t,x) if you try to write this code on matlab a sine graph will appear,the thing i couldnt write as an equation in line 4, i want my user interface to give me the same sine graph after the user enters the sampling rate and frequency values. thank you
double phasecent = 0; double samplerate = 96000; double freq = 1000; for (int i = 0; i < samplerate; i++) { double t = Math.Sin(freq * (2 * Math.PI) * (phasecent) / samplerate); phasecent++; double x = Math.Sin(2 *Math.PI*freq*t); chart1.Series["b2"].Points.AddXY(x, t); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)