help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Surface fitting


From: Jan-Peter Schümann
Subject: Re: Surface fitting
Date: Fri, 27 Feb 2015 20:16:22 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0


On 23.02.2015 09:47, Markus Appel wrote:
On 02/22/2015 09:14 PM, jlapin wrote:
Hello Everyone

I am currently working in a Pchem lab and am trying to model
spectroscopy data. I have a 256 x 433 unit matrix of signal data.
Each signal is a function of a wavelength value and a time value.
So far I have used the functions "nonlin_curvefit" and "leasqr" to
fit the data one row(or column) at a time. Now I would like to fit
the entire surface to an equation that is a function of both time
and wavelength.

The inputs of the function leasqr are leasqr(*x,y,pin,f*). Y will
be the 256x433 signal data, pin will be my initial parameter
guesses and f will be my function handle. The problem I am having
is the x vector(s) for independent values. This is a function of
both the wavelength and time variables.

What can I put in for the x argument so that the leasqr function
fits the entire matrix?

Thank you Joel



-- View this message in context:
http://octave.1599824.n4.nabble.com/Surface-fitting-tp4668758.html
Sent from the Octave - General mailing list archive at Nabble.com.

_______________________________________________ Help-octave mailing
list address@hidden
https://lists.gnu.org/mailman/listinfo/help-octave

Hi Joel,

the 'x' vector is not actually used for fitting and just handed
through to your model function, so you are more or less free to put in
what you want. Especially leasqr might check that the dimensions are
equal to 'y' though, and complain if otherwise. nonlin_curvefit might
be more flexible, but I cannot try it out right now.

You can always wrap your model function before giving it to the
fitting routines to use multiple independent variables:
[...] = nonlin_curvefit( @(p,x) MyModel(p,lambda,t), pin, [], y);
(Not sure if empty vector for 'x' works. If not, give 'y' again as an
ugly trick ...)

The other and probably cleaner possibility is to use nonlin_residmin,
in that case you would need to calculate the residuals on your own:
[...] = nonlin_residmin( @(p) (MyModel(p,lambda,t) - y).^2 ./
errors.^2, pin);

Hope it helps,
Markus

_______________________________________________
Help-octave mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-octave
Hi, I am having a similar problem - and beyond.

I am trying to plot measured data in 3d. I do this via

trisurf(tri, xx, yy, epsa, 'facecolor', 'flat', 'edgecolor', 'none')

So far, so good, that works. Plot looks ok. What I finally want to achieve is I want to use it in pdflatex, where the font of the axis numbers and description are tyeset in pdflatex. I have tried the print options with the several machines available. '-dtikz' I do not dare to compile, it gives me 20.000 lines or 8MB of code. Since I will be using a couple of these graphs finally, this is not an option.

So I have been trying to have octave print a tex-like font for all text because I thought I'd print a pdf. That does not work. I have tried several Ideas from the net, including

zlabel('\epsilon [%]', 'FontName', 'Latin Modern Roman', 'FontSize', 10)
set(gca, 'FontName', 'Latin Modern Roman', 'FontSize', 10)

or

set(0,'DefaultTextFontname', 'CMU Serif')

or

set(0,'DefaultTextFontname', 'Latin Modern Roman')

and the like.

But even if the font would be ok, then I run into another problem: the facecolor is not flat when I print a pdf. It is kind of translucent, which makes the file big and the grid is large pixels all over.

I have also tried -dsvg. Aside from the translucence and the file size, that does give the desired output using pdf_tex export function of Inkscape.

I have come across the idea to reduce my datapoints. That is fine and I am doing that already but further reduction would make the graph look ugly.

I am running linux mint and octave 3.8.1.

Would Markus' solution above be of help there for me? If so, could you please explain it for beginners, please? I like the interpolation idea, it promises a smooth color gradient of the surface.

I would also be happy to learn about a solution in Gnuplot, as I do most of my plotting work like that. I have only found a way that would require data sorting using splot. Here, for me sorting the data is the issue.

Thanks for your help, J-P



reply via email to

[Prev in Thread] Current Thread [Next in Thread]