Sampling Data (Urgent help needed)
Afficher commentaires plus anciens
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
Réponses (1)
Wayne King
le 17 Nov 2011
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 commentaires
Feruz
le 17 Nov 2011
Walter Roberson
le 17 Nov 2011
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
Catégories
En savoir plus sur MATLAB dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!