MATLAB: Plot a sine wave with the following… how to plot it sine wave Create a time vector, sine wave, 5 periods, 1 kHz, amplitude 2 volts in 5 x 1024 samples (time axis) as well as 5 periods in 4096 samples Best Answer You're very close:freq=1000;%1 kHzt=linspace(0,5,1024)/freq;%from 0 to 5 periods in 1024 stepsA=2;%amplitudex=A*sin(freq*t*2*pi);plot(t,x)I don't really see how more samples will change things, but you can just change the linspace parameters.BTW, for next time: have a read here and here. It will greatly improve your chances of getting an answer. Related SolutionsMATLAB: I need to plot a sine wave Francis - from an example at fft, we can do t = 0:0.01:1; f = 15; a = 4; y = a*sin(2*pi*f*t); plot(t,y);Though ten samples (your t) may not be enough to accurately represent the sine wave (that you are attempting), so try Fs = 1000; t = linspace(0,1-1/Fs,Fs); f = 15; a = 4; y = a*sin(2*pi*f*t); plot(t,y); MATLAB: I am not getting correct output for this sawtooth plot T = 6; Fs = 1e3;dt = 1/Fs;t = 0:dt:T-dt;a = 4;x = a*sawtooth(2*pi*t);t = t*5; plot(t,x) grid on Related QuestionCode to implement FSK on sin waveInput conditional sine waveSine generation with hanning window
Best Answer