how can i give values in the range[10 300] to v inside the for loop(loop for time 1:4000)?

sir i'm giving a portion of the code here.. for i=1:n%n=4000 x1(i) = (v*t(i)+A*sin(2*pi*f*t(i)))*(inc/(2*pi)); xq1(i)= round(x1(i)/dx)*dx; end now for different values of V in the range [10 300] i have to plot graph.what i have to do?

 채택된 답변

Mischa Kim
Mischa Kim 2014년 3월 20일
편집: Mischa Kim 2014년 3월 20일
Divya, no need for loops:
t = 1:4000;
v = 10:10:300;
A = 1; f = 1; inc = 1; dx = 1;
X = v'*t + A*ones(numel(v),1)*sin(2*pi*f*t)*inc/(2*pi);
Xq1 = round(X/dx)*dx;
plot(t,Xq1)
X and Xq1 are matrices, where each row corresponds to a particular value of v and the columns represent the individual time steps.

댓글 수: 6

thank you so much sir....
but why i am not getting like quntized signal?why it is getting as straight line?
It's all a matter on how you set the parameters. Try
t = 1:0.1:40; % that's just to zoom in...
v = 10:10:50; % less lines, easier to see
A = 10; f = 1; inc = 1; dx = 10; % parameters
sir i have to get quantized sine wave..then what to do?
sir do u know how to do the coding for timestamping concept used in optical encoder for resolution improvement?
No, I don't. I recommend posting a separate question to get help from specialists in this area.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Optics에 대해 자세히 알아보기

질문:

2014년 3월 20일

댓글:

2014년 3월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by