adding a regression area to a 3d plot
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
First of all I would like to mention that I don't know much about matlab programming but I'm trying to do something that I think is simple.
I created a 3d scatterplot using the "plots" tab. My data set has 3 arrays; x, y, and z.
That was easy enough. Now I would like to add a best fit surface area to the plot. How do I do that? I tried following other questions that were asked but I wasn't able to understand the code. I am not creating a function. I am just using using the command window with the x,y, and z arrays in work space.
Please help!
Thanks!
0 Kommentare
Antworten (1)
Amir
am 13 Aug. 2014
Bearbeitet: Amir
am 13 Aug. 2014
Hi Mostafa. Try this code:
x=5*rand(1,1000); % 1000 random number between 0 and 5
x=x'; % transpose (row to vector)
y=sin(x)/3;
z=x.^2-y.^2 + sin(x.*y) + 5 * rand(size(x)); % rand for some noise
f = fit( [x, y], z, 'poly23' );
plot(f, [x,y], z);
Hope this helps you.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Scatter Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!