[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
fsolve crashes Octave
From: |
testertester |
Subject: |
fsolve crashes Octave |
Date: |
Sun, 13 Sep 2015 10:40:13 -0700 (PDT) |
Hi,
I'm attempting to solve a nonlinear equation of five variables for each of
about 100 sets of (x,y) data using fsolve - but whenever I run my code with
the dataset I have, it crashes Octave. I'm basically trying to do a
different regression for each (x,y) set, but I can't even get the first set
of data working.
Here is my code:
clear all; close all;
C06B = csvread('C06B.csv');
x = C06B([2:44],1);
y = 0.1 ./ (C06B([2:44],2));
[c, fval] = fsolve (@(c) (1/(c(1)*c(2)*sqrt((-1.6e-38*(c(3)^2)) +
(0.8*(10^-2))^2*((x - c(4)).^2)) + c(5) - y)), [1.9, 10e-2, 10^34, 100,
700]);
%c0 = [1.9, 10e-2, 10^34, 100, 700];
guess = (1 ./ (c(1).*c(2).*sqrt((-1.6e-38.*(c(3)^2)) +(0.8*(10^-2)).^2*((x -
c(4)).^2))) + c(5));
plot(x, y, x, guess);
The data I'm using (C06B.csv) is attached. I'm pretty sure there are errors
in my formulas or function design, but I can't figure them out because
Octave keeps crashing.
Thanks. C06B.csv
<http://octave.1599824.n4.nabble.com/file/n4672550/C06B.csv>
--
View this message in context:
http://octave.1599824.n4.nabble.com/fsolve-crashes-Octave-tp4672550.html
Sent from the Octave - General mailing list archive at Nabble.com.
- fsolve crashes Octave,
testertester <=