DATA VISUALISATION
OBJECTIVE
- To visualize the data in different ways
LEARNING OUTCOMES
- After the completion of this experiment students will be able to plot data using scatter, boxplot, histogram, bar functions
SOFTWARE USED:
MATLAB® R2017a
1.
Plot a cosine signal added with random noise using scatter plot
PROGRAM
x = 0:0.01:10;
len=length(x);
y = cos(x) + rand(1,len);
sz = 25;
c = 0:0.01:10;
scatter(x,y,sz,c,'filled')
title('Scatter plot: Cosine signal added
with a random noise')
OUTPUT
2. Plot some
random data using scatter plot
PROGRAM
x = rand(1000,1);
y = rand(1000,1);
s =
scatter(x,y,[],'k');
OUTPUT
3.Plot the bar plot of the data y= [75 91 105 123.5 131 150 179 203 226 249 281.5] having values on the x axis as [1900:10:2000].
PROGRAM
x = 1900:10:2000;
y = [75 91 105 123.5 131 150 179 203 226
249 281.5];
bar(x,y)
OUTPUT
4. Plot the bar plot of the matrix
2 6 9
11 22 32
Against x as [1980 1990]
PROGRAM
x = [1980 1990];
y = [2 6 9;11 22 32];
bar(x,y)
OUTPUT
5. Plot the bar plot of some random data
PROGRAM
clc ;
clear all;
close all;
x = rand (1,5)
y = rand (1,5)
bar (x, y);
OUTPUT
6.
Plot the histogram of some random data, with the number of bins specified
PROGRAM
x = randn(1000,1);
nbins = 25;
h = histogram(x,nbins)
OUTPUT
7. Plot
the data [57, 57, 57, 58, 63, 66, 66, 67, 67, 68, 69, 70, 70, 70, 70, 72, 73,
75, 75, 76, 76, 78, 79, 81] using box plot.
PROGRAM
x=[57, 57, 57, 58,
63, 66, 66, 67, 67, 68, 69, 70, 70, 70, 70, 72, 73, 75, 75, 76, 76, 78, 79,
81];
boxplot(x)
OUTPUT
8. Define ‘t’ as
an array (-10, 10) with an increment of 0.01. Plot
(i) cos(t)
(ii) cost cos5t +
cos5t
On the same graph.
Create legends in plots
PROGRAM
clc;
clear all;
close all;
t=-10:0.01:10;
y=cos(t);
plot(t,y,'k','linewidth',2)
hold on;
y=(cos(t).*cos(5*t))+cos(5*t);
plot(t,y,'r',
'linewidth',2)
hold on;
legend('cos(t)','cost
cos5t + cos5t');
OUTPUT
Plot a random signal using stem plot
PROGRAM
clc;
clear all;
close all;
x = rand(1,10);
y= rand(1,10);
stem(x,y);
title('stem plot')
xlabel('x
values');
ylabel('y
values');
OUTPUT
Comments
Post a Comment