how to plot the data and superimpose the mean of the data?
Afficher commentaires plus anciens
I am required to plot 20 second data of my veleocity. then i need to superimpose the mean of the velocity. Can somebody look into my codes. I dont know how to convert the velocity in Hz into second. The velocity is measure with a device that collect data 100 times in a second.
here is my code
U20=U(1:2000,:); % Selection of 20 seconds of data
Usec=U20/100; % 1 second =100 Hz (I think i am making mistake here)
plot(Usec); % ploting of instantinous velocity
Umean=mean(Usec); % Mean of the sample
hold on
plot(Umean,'-','LineWidth',1); % Superimposing the mean velocity
xlabel('sample data length');
ylabel('Stream wise velocity');
The graph should look like the attached picture where U is the mean and U' is the instantaneous velocity.

many thanks
3 commentaires
Guillaume
le 18 Oct 2014
Velocity is neither measured in Hz nor in seconds. It is measured in m/s or similar unit (i.e. length/time). Hz is the unit of frequency, second the unit of time. If what you've measured is in Hz or s, you won't be able to convert it to a velocity without a distance measurement.
Hydro
le 18 Oct 2014
Réponse acceptée
Plus de réponses (1)
Assuming you have a velocity U measured for 20 seconds (see comment to your question),
t = linspace(0, 20, numel(U)); %generate a time vector for 20 seconds with as many elements as U
plot(t, U);
hold on
Umean = mean(U);
plot(t, Umean);
xlabel('times (s)');
ylabel('velocity (m/s)');
Catégories
En savoir plus sur Annotations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



