How do I extract a two variable function from a 3D plot created from multiple 2D plots? Help!!!
Show older comments
Hello,
I have created a 3D plot form a set of gaussian functions. the matlab scrpit is presented below:
% 3D PLOT OF GAUSSIAN CURVE FITTING FOR ALL WATER HEIGHTS AT 4MM SWAY AMPLITUDE
Frequencies = linspace(0.15,0.9,10000);
WaterHeight=fliplr([2 4 6 8 10 12 14 16]);
a1 = 9.632;
b1 = 0.5993;
c1 = 0.1175;
a2 = 1.792;
b2 = 0.8155;
c2 = 0.07807;
a3 = 12.63;
b3 = 0.6056;
c3 = 0.03792;
Gauss1_16cm = a1*exp(-((Frequencies-b1)/c1).^2) + a2*exp(-((Frequencies-b2)/c2).^2) + a3*exp(-((Frequencies-b3)/c3).^2);
a1 = 6.142;
b1 = 0.5836;
c1 = 0.1477;
a2 = 23.06;
b2 = 0.5809;
c2 = 0.03231;
a3 = 13.21;
b3 = 0.513;
c3 = 0.009901;
Gauss1_14cm= a1*exp(-((Frequencies-b1)/c1).^2) + a2*exp(-((Frequencies-b2)/c2).^2) + a3*exp(-((Frequencies-b3)/c3).^2);
a1 = 26.98;
b1 = 0.5538;
c1 = 0.01255;
a2 = 9.196;
b2 = 0.4972;
c2 = 0.01443;
a3 = 6.197;
b3 = 0.5444;
c3 = 0.1275;
Gauss1_12cm= a1*exp(-((Frequencies-b1)/c1).^2) + a2*exp(-((Frequencies-b2)/c2).^2) + a3*exp(-((Frequencies-b3)/c3).^2);
a1 = 12.12;
b1 = 0.5148;
c1 = 0.02505;
a2 = 10.18;
b2 = 0.4623;
c2 = 0.01164;
a3 = 5.469;
b3 = 0.5034;
c3 = 0.1167;
Gauss1_10cm= a1*exp(-((Frequencies-b1)/c1).^2) + a2*exp(-((Frequencies-b2)/c2).^2) + a3*exp(-((Frequencies-b3)/c3).^2);
a1 = 18.17;
b1 = 0.4708;
c1 = 0.05979;
a2 = -10.15;
b2 = 0.4985;
c2 = 0.03218;
a3 = -9.941;
b3 = 0.458;
c3 = 0.008146;
Gauss1_8cm= a1*exp(-((Frequencies-b1)/c1).^2) + a2*exp(-((Frequencies-b2)/c2).^2) + a3*exp(-((Frequencies-b3)/c3).^2);
a1 = 10.2;
b1 = 0.3926;
c1 = 0.04446;
a2 = -9.91;
b2 = 0.4107;
c2 = 0.01875;
a3 = 7.874;
b3 = 0.4176;
c3 = 0.01041;
Gauss1_6cm= a1*exp(-((Frequencies-b1)/c1).^2) + a2*exp(-((Frequencies-b2)/c2).^2) + a3*exp(-((Frequencies-b3)/c3).^2);
a1 = 0;
b1 = 62.49;
c1 = 9.757;
a2 = 1.186;
b2 = 0.362;
c2 = 0.01799;
a3 = 4.828;
b3 = 0.3143;
c3 = 0.03637;
Gauss1_4cm= a1*exp(-((Frequencies-b1)/c1).^2) + a2*exp(-((Frequencies-b2)/c2).^2) + a3*exp(-((Frequencies-b3)/c3).^2);
a1 = 2.145;
b1 = 0.2317;
c1 = 0.02334;
a2 = 0;
b2 = 0.2299;
c2 = 2.694e-05;
a3 = 0.806;
b3 = 0.209;
c3 = 0.01082;
Gauss1_2cm= a1*exp(-((Frequencies-b1)/c1).^2) + a2*exp(-((Frequencies-b2)/c2).^2) + a3*exp(-((Frequencies- b3)/c3).^2);
Amplitude=[Gauss1_16cm;Gauss1_14cm;Gauss1_12cm;Gauss1_10cm;Gauss1_8cm;Gauss1_6cm;Gauss1_4cm;Gauss1_2cm]';
h1=mesh(Amplitude);
set(h1,'XData',WaterHeight);
set(h1,'YData',Frequencies);
xlabel('Waterheight');
ylabel('Frequencies');
zlabel('Amplitude');
Each gaussian function are the result of a curve fitting procedure for a set of data points in the xy plane. The x value represents the frequency, and the y, or f(x), is the amplitude. There were eight different data sets in total, and thereby eight different gaussian functions. Lets call the third parameter giving these eight different data sets w for waterheight.I was supposed to plot these gaussian curves up against each other in a 3D plot, as done above. My question is this:
Is there a option in matlab, of any kind, that applies this 3D plot to give me a function which includes this third parameter? So instead of having a function with one variable, I get a function with two variables. For instance, lets say that these eight gaussian functions are extracted for w = 16, 14, 12, 10, 8, 6, 4, 2 allowing me to find f(x) for these variables. However, for 15 13 16 etc. f(x) is unknown. Is there a option in matlab that creates a function f(x,w) that allows me to predict f at w=15, 13, 16 from the plot i just developed?
Any help will be strongly appreciated!
Best Regards
Eric
Answers (0)
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!