Is it possible to make pdf plot from matrix with mean value?
Mostrar comentarios más antiguos
need code for this type
Respuestas (3)
Yusuf Suer Erdem
el 24 de Dic. de 2021
Try these codes below please;
clc;
clear;
close all;
Data=rand(32,247);
data_mean=mean(Data,2);
plot(data_mean);
ax = gca;
exportgraphics(ax,'LinePlot.pdf')

5 comentarios
Maddy
el 24 de Dic. de 2021
Yusuf Suer Erdem
el 24 de Dic. de 2021
Try these codes below;
clc;
clear;
close all;
r2 = randi([1 100],100,2000);
x = r2(:,1);
pd = fitdist(x,'Normal');
m = mean(pd);
x_pdf = [1:0.1:100];
y = pdf(pd,x_pdf);
figure
histogram(x,'Normalization','pdf')
line(x_pdf,y)
ax = gca;
exportgraphics(ax,'LinePlot.pdf')
Yusuf Suer Erdem
el 29 de Dic. de 2021
Editada: Yusuf Suer Erdem
el 29 de Dic. de 2021
hi Mohammed, if you are having troubles when you change 'r2' make sure your new matrix has 'double' data type. and also if you see there is 'x_pdf = [1:0.1:100];' matrix there. that matrix should have same amount of columns as like your new r2 does.
Yusuf Suer Erdem
el 30 de Dic. de 2021
could u provide me your P matrix. put it in .mat file and share here please.
Maddy
el 30 de Dic. de 2021
0 votos
Yusuf Suer Erdem
el 30 de Dic. de 2021
Let's see. I used these codes below and it did not give me error. But the 'P' matrix ' s values are pretty small. So I can not see them clearly on the graph.
x = double(P(:));
That command takes the P matrix and converts it into all column vector because fitdist() requires that.
clc; clear; close all;
load('P.mat');
x = double(P(:));
pd = fitdist(x,'Normal');
m = mean(pd);
x_pdf = [1:0.1:100];
y = pdf(pd,x_pdf);
figure
histogram(x,'Normalization','pdf')
line(x_pdf,y)
ax = gca;
exportgraphics(ax,'LinePlot.pdf')
Categorías
Más información sobre Sparse Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!