how can I change level of sine wave ?

조회 수: 3 (최근 30일)
Sarfaraz Ahmed
Sarfaraz Ahmed 2018년 10월 10일
편집: Sarfaraz Ahmed 2018년 10월 11일
I want to change level of sine wave from 0-32. right now the below code generate y-axis from -64 to 64. I want to make it center at 32 not at 0. so how can i shift the level so that the center would be 32 not 0. it means y-axis would shift from 0 to 64 with center at 32. kindly help in this regard. Thanks
fs=500e3; %Very high sampling rate 500 kHz
f=10e3; %Frequency of sinusoid
nCyl=5; %generate five cycles of sinusoid
t=0:1/fs:nCyl*1/f; %time index
x=64*sin(2*pi*f*t);
plot(t,x)

채택된 답변

Andy
Andy 2018년 10월 11일
x=(sin(2*pi*f*t)*32)+32;
  댓글 수: 2
Sarfaraz Ahmed
Sarfaraz Ahmed 2018년 10월 11일
Thanks Andy. It's working !
Sarfaraz Ahmed
Sarfaraz Ahmed 2018년 10월 11일
편집: Sarfaraz Ahmed 2018년 10월 11일
Sir, Do you know answer for this thread ?
https://kr.mathworks.com/matlabcentral/answers/423399-sample-on-alternate-edge-of-clock-how-can-sample-with-respect-of-alternate-edge-of-clock

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Measurements and Feature Extraction에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by