Sampling Data (Urgent help needed)

조회 수: 5 (최근 30일)
Feruz
Feruz 2011년 11월 17일
Hello, everybody,
I have a question regarding sampling data.
I have a case where I use
x = linspace(0, 1, N);
and after calculations I did plot of equation with, let say U
plot(x,U);
I want to sample data in long vector when x = 0.22 but let say with linspace I don't get this value, but in the plot I do have it. Note that function is time dependent, and I intend to use long vector with fft and plot...
Is there way to find or use plot or any trick to get what I want.
Thanks in advance.
Regards, Feruz

답변 (1개)

Wayne King
Wayne King 2011년 11월 17일
You can also change the increment between the values in your x vector so that you do have 0.22.
x = 0:.01:1-0.01;
U = exp(-x);
x(23)
U(23)
% or
x = linspace(0,0.99,100);
U = exp(-x);
x(23)
U(23)
  댓글 수: 2
Feruz
Feruz 2011년 11월 17일
Thanks for answer...
Though, I want to check
vc = [];
if (x == 0.22)
vc = [vc U]
in that form, not by index, but by the value.
Making everything manually hurts, so that I was wondering or wanted to make it automate, so that in any value of x in that interval I can sample...
Walter Roberson
Walter Roberson 2011년 11월 17일
You are never going to get an x of exactly 0.22.
http://matlab.wikia.com/wiki/FAQ#Why_is_0.3_-_0.2_-_0.1_.28or_similar.29_not_equal_to_zero.3F

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

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by