How to make gaussian pplot with my data
9 ビュー (過去 30 日間)
古いコメントを表示
Hi, I have a question and I don't understending how to do something and which function I need to solve the problem.
I have external data from two vector in excel and I need to produce two plot like a gaussian graph with them.
I used xlsread to put the data in matlab and histfit for plot the probability density function plot with histogram :
[num,txt,raw] = xlsread('Gaussian.csv');
x1 = num(:, 1);
x2 = num(:, 2);
G1 = histfit(x1);
But I need the probability density function without the histogram and I don't understand how histfit interpolate automatically the data, I tried to use pdf function but I want that the mu be in the average of my data for x-axis and I don't need to modify sigma. I don't understand how to use interp1 for my data to create the gaussian plot e how to overlap the second gaussian plot with the first one.
thank you for the answer.
0 件のコメント
回答 (1 件)
SaiDileep Kola
2020 年 1 月 29 日
As per my understanding you want to plot the probability density function with “mu” which must be average of your data. You can do this with the help of “mean” function. You can create gaussian pdf for your data and see how they overlap by setting the distribution name as “Normal”. Here is a sample code:
x1 = [-2 -1 0 1 2];
mu=mean(x1);
pd = makedist('Normal','mu',mu,'sigma',sigma);
y = pdf(pd,x1);
plot(x1,y);
hold on
x2 =(-9:5);
mu=mean(x2);
pd = makedist('Normal','mu',mu,'sigma',sigma);
y = pdf(pd,x2);
plot(x2,y);
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!