Réponse apportée

Issue with numerical integration of two variable function

You created only function handles. So f(x,y) = ..... To compute the numerical value you need to assign numerical values to x an...

Issue with numerical integration of two variable function

You created only function handles. So f(x,y) = ..... To compute the numerical value you need to assign numerical values to x an...

presque 3 ans il y a | 0

Réponse apportée

Index in position 2 exceeds array bounds (must not exceed 2). Error in fun1 (line 5)

You calculate: for i=1:N for j=1:D pos(i,j)=lb(j)+rand*(ub(j)-lb(j)); end end with D= 2, so pos is a...

Index in position 2 exceeds array bounds (must not exceed 2). Error in fun1 (line 5)

You calculate: for i=1:N for j=1:D pos(i,j)=lb(j)+rand*(ub(j)-lb(j)); end end with D= 2, so pos is a...

presque 3 ans il y a | 0

Réponse apportée

How to Solve matrix equations in Matlab

Your method seems valid. But of course fsolve will only attempt to find a local solution, and it might get stuck in a place wher...

How to Solve matrix equations in Matlab

Your method seems valid. But of course fsolve will only attempt to find a local solution, and it might get stuck in a place wher...

presque 3 ans il y a | 1

Réponse apportée

Index exceeds the number of array elements

The argument in brackets should be an index number, so for example: x = 1:10; %a 1 x 10 vector for ix = 1:size(x,2); f(ix) = ...

Index exceeds the number of array elements

The argument in brackets should be an index number, so for example: x = 1:10; %a 1 x 10 vector for ix = 1:size(x,2); f(ix) = ...

presque 3 ans il y a | 0

| A accepté

Réponse apportée

How to put fsolve in a loop, using 2 unknowns?

Replace the first line with: H = @(X)fsolve_root_finding(X(1),X(2));

How to put fsolve in a loop, using 2 unknowns?

Replace the first line with: H = @(X)fsolve_root_finding(X(1),X(2));

environ 3 ans il y a | 0

Réponse apportée

Need to apply trapezoidal rule for double integration with an array by using the for loop

There are two things that need correction: 1) Remove the line i=i+1. This is what the for loop does. (also don't use "i" in ge...

Need to apply trapezoidal rule for double integration with an array by using the for loop

There are two things that need correction: 1) Remove the line i=i+1. This is what the for loop does. (also don't use "i" in ge...

environ 3 ans il y a | 0

Réponse apportée

Error in find Precision recall curve

Try without the quotations: [XCrit,tpr,YCrit,ppv] = perfcurve(Y,diffscore1,'HandGrip'); In general quotations are used to sp...

Error in find Precision recall curve

Try without the quotations: [XCrit,tpr,YCrit,ppv] = perfcurve(Y,diffscore1,'HandGrip'); In general quotations are used to sp...

environ 3 ans il y a | 0

| A accepté

Réponse apportée

I am solving a nonlinear Model predictive control problem . I get the following error. Can anybody help me understand the error report?

The error says that the derivative at the initial point (x0) is either NaN, infinity, or complex. So you should check whether th...

I am solving a nonlinear Model predictive control problem . I get the following error. Can anybody help me understand the error report?

The error says that the derivative at the initial point (x0) is either NaN, infinity, or complex. So you should check whether th...

environ 3 ans il y a | 0

| A accepté

Réponse apportée

time series interpolation of irregular data

You can use "griddedInterpolant". I would use 'pchip' as method.

time series interpolation of irregular data

You can use "griddedInterpolant". I would use 'pchip' as method.

environ 3 ans il y a | 0

Réponse apportée

Multiple sample values into scatteredInterpolant

What works is: Make a 3D array from B, so: for ih=1:length(B) B_3D(:,:,id) = B{ib) end And then add a vector 'h...

Multiple sample values into scatteredInterpolant

What works is: Make a 3D array from B, so: for ih=1:length(B) B_3D(:,:,id) = B{ib) end And then add a vector 'h...

plus de 3 ans il y a | 0

Réponse apportée

x undefined (Catenary Cable Case Study)

What you have done is programmed a function. So this function calculates fval when you give a value of x. You can now call this...

x undefined (Catenary Cable Case Study)

What you have done is programmed a function. So this function calculates fval when you give a value of x. You can now call this...

plus de 3 ans il y a | 1

| A accepté

Réponse apportée

Locating point on x-axis where the slope is decreasing

Bascially you want to get the index when the change in theta becomes negative: dtheta = diff(theta); index = find(dtheta<0,1...

Locating point on x-axis where the slope is decreasing

Bascially you want to get the index when the change in theta becomes negative: dtheta = diff(theta); index = find(dtheta<0,1...

plus de 3 ans il y a | 0

Réponse apportée

Conversion to logical from sym is not possible.

g = 3; eff1=@(rr)-(1.8-0.8.*(1+rr)./(1-7.56.*g*rr))*rr/(0.01-0.11.*rr+0.06.*exp(23*rr)); x=fminbnd(eff1,-1,1); You could s...

Conversion to logical from sym is not possible.

g = 3; eff1=@(rr)-(1.8-0.8.*(1+rr)./(1-7.56.*g*rr))*rr/(0.01-0.11.*rr+0.06.*exp(23*rr)); x=fminbnd(eff1,-1,1); You could s...

plus de 3 ans il y a | 0

Réponse apportée

Hourly averages over a 20yr time series

Its not exactly clear over which values you want to calculate the mean, but have a look at this function, that can calculate mov...

Hourly averages over a 20yr time series

Its not exactly clear over which values you want to calculate the mean, but have a look at this function, that can calculate mov...

plus de 3 ans il y a | 0

Réponse apportée

Removing/clearing NaN/0 values from matrix/array data

A1 = A(A~=0 & B~=0) should work

Removing/clearing NaN/0 values from matrix/array data

A1 = A(A~=0 & B~=0) should work

plus de 3 ans il y a | 0

Question

1 iteration in fsolve: new x and no more

I want to use fsolve to only use one iteration: get the Jacobian, get x1 and done. However when test the code below, which tries...

plus de 3 ans il y a | 2 réponses | 0

Réponse apportée

Optimization of system ODE

It is still not clear what your problem is. Do you get an error? Do you get a different solution than you expected? Anyway f...

Optimization of system ODE

It is still not clear what your problem is. Do you get an error? Do you get a different solution than you expected? Anyway f...

plus de 3 ans il y a | 1

Question

Why is EACH function evaluation inside a parfor loop much faster then ONE evaluation outside the loop?

Basically I calculate a finite difference Jacobian of a function, as shown below. The function evaluation labelled SINGLE RUN t...

plus de 3 ans il y a | 1 réponse | 0

Question

Second Order optimality fmincon

Someone explained the second order condition for optimality of a constrained optimization problem here: https://math.stackexch...

environ 5 ans il y a | 1 réponse | 0

Question

Incorrect solution for symmetric problems in fmincon

If I maximize XX(1)^2+XX(2)^2 subject to x1 + x2 <=1 and use starting value X0=[0.5,0.5] I get as solution X=[0.5,0.5], although...

plus de 5 ans il y a | 1 réponse | 0

Question

patternsearch with nonlinear equality constraint: any advice for more efficient steps?

Dear all, I have a constrained optimization problem which is not differentiable (because of some random errors), but it should ...

plus de 5 ans il y a | 1 réponse | 0

Réponse apportée

How to normalize curves with multiple peaks such that each peak will be 1 and each valley will be 0?

Yeah, you would have to calculate a scaling factor for each peak/trough. In one dimension you can then use the scaling factor fo...

How to normalize curves with multiple peaks such that each peak will be 1 and each valley will be 0?

Yeah, you would have to calculate a scaling factor for each peak/trough. In one dimension you can then use the scaling factor fo...

plus de 5 ans il y a | 0

Réponse apportée

Tangent at a given point to a nonlinear curve

I think you need to be a bit more precise in what you want: you have data with errors in them, and you want to fit a curve that ...

Tangent at a given point to a nonlinear curve

I think you need to be a bit more precise in what you want: you have data with errors in them, and you want to fit a curve that ...

plus de 5 ans il y a | 0

| A accepté

Réponse apportée

Matlab R2014A blurry on high-dpi windows device

Two things did it for me: 1. go to matlab/bin and right click application, choose compatibility and check "disable scaling on h...

Matlab R2014A blurry on high-dpi windows device

Two things did it for me: 1. go to matlab/bin and right click application, choose compatibility and check "disable scaling on h...

plus de 8 ans il y a | 0

Réponse apportée

fmincon and exitflag = -2 or 2 / non respect of constrained conditions

getting exit message 2 is not bad but if you insist on having 1, you could try to use smaller values for TolX (ie.. 1e-10 or eve...

fmincon and exitflag = -2 or 2 / non respect of constrained conditions

getting exit message 2 is not bad but if you insist on having 1, you could try to use smaller values for TolX (ie.. 1e-10 or eve...

plus de 9 ans il y a | 0

| A accepté

Réponse apportée

Why does the first value in loop get overwritten

Thanks guys... normally i never save iteration variables like 'fi' but in this case the files contained "fi = 1". very silly

Why does the first value in loop get overwritten

Thanks guys... normally i never save iteration variables like 'fi' but in this case the files contained "fi = 1". very silly

plus de 11 ans il y a | 0

Question

Why does the first value in loop get overwritten

For some reason when fi == 1, NPV_list(1,1) is inserted correctly, but when fi=2 the value gets overwritten, which i dont unders...

plus de 11 ans il y a | 3 réponses | 0

Réponse apportée

Vectorize sum of discount rates

thank you all for you answers... all did what i wanted, but the one by Matt Fig is the most simple

Vectorize sum of discount rates

thank you all for you answers... all did what i wanted, but the one by Matt Fig is the most simple

plus de 11 ans il y a | 0

Question

Vectorize sum of discount rates

Hi, I want to vectorize the calculation of series like this: [R^0;R^0+R^1;R^0+R^1+R^2;...etc. Im quite sure this should b...

plus de 11 ans il y a | 4 réponses | 0

Réponse apportée

sum elements of matrix if...

It seems i can not edit my comment... so here again (sorry for mess, but i forgot to 'code' my code) Ok, i was not clear let ...

sum elements of matrix if...

It seems i can not edit my comment... so here again (sorry for mess, but i forgot to 'code' my code) Ok, i was not clear let ...

presque 12 ans il y a | 0