File:Deviation from Mean of a Random Distribution.jpg

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Deviation_from_Mean_of_a_Random_Distribution.jpg(560 × 420 pixels, file size: 39 KB, MIME type: image/jpeg)

Captions

Captions

A random distribution plotted along with mean and standard deviation.

Summary[edit]

Description
English: See below for Matlab code.

% Generate some random data x = 1:25; y = 20*rand(1,25)+10;

% Calculate the mean and standard deviation of y y_mean = mean (y); y_std = std (y);

% Plot y versus x with a line plot(x,y,'b', 'LineWidth', 2); hold on

% Plot the mean of y as a dashed line plot plot(x,y_mean*ones(size(x)), 'k--'); % plot(x,median(y)*ones(size(x)),'r--')

% Plot the error bars for y using one standard deviation % errorbar(x,y,y_std*ones (size (y)), 'b', 'LineStyle', 'none');

% Plot the shaded area for y using one standard deviation y_upper = y_mean + y_std; y_lower = y_mean - y_std; x_fill = [x, fliplr(x)]; y_fill = [y_upper, fliplr(y_lower)]; fill([min(x_fill), max(x_fill), max(x_fill), min(x_fill)],[y_fill(2), y_fill(2), y_fill(1), y_fill(1)], 'r', 'FaceAlpha', 0.2, 'EdgeColor', 'none'); % fill (x_fill, y_fill, 'b', 'FaceAlpha', 0.2, 'EdgeColor', 'none');

% Add some labels and legends xlabel ('Data Observation'); ylabel ('Y'); grid on; title('Deviation from Mean in Random Distribution') legend ('Data', 'Mean', 'Standard Deviation', 'Location', 'best');

ylim([10 40]); hold off
Date
Source Own work
Author Grw66

Licensing[edit]

I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current22:21, 19 November 2023Thumbnail for version as of 22:21, 19 November 2023560 × 420 (39 KB)Grw66 (talk | contribs)Uploaded own work with UploadWizard

There are no pages that use this file.

File usage on other wikis

The following other wikis use this file:

Metadata