Answered
fminsearch output size bigger than the variables to optimize?
[10000 1000 0.2] instead of [10000 1000 0,2] as the vector of initial conditions. MATLAB is not Excel.

3 years ago | 0

| accepted

Answered
How do I properly use the "while", "for", "loop" command in this problem?
A = [71.213; 74.499; 79.175; 54.163; 83.008; 52.615]; %Column vector B = length(A); %size of column (number of elements) %H =...

3 years ago | 1

| accepted

Answered
I want to show r^2 and the poly1 ec on the plot
format short g %datos del equipo df=6.1; %cm hf=25; %cm dtr=35; %cm htr=62; %cm %datos del usuario V1=60; V2=0; Vr=V1...

3 years ago | 1

| accepted

Answered
The method fminsearch() cannot find minimum of quadratic form for 5 variables
The fact that the solvers have the same name under "Octave" and "MATLAB" doesn't mean they are identical - they only have the sa...

3 years ago | 0

| accepted

Answered
Plotting a system of non-linear ODES to model tumour volume.
lotka = @(t,y)[(1.2*(y(1)-0.8))*((1-y(1)-(1-y(1))^(2/3)));1.2*y(2)*(y(1)-0.8)]; t0 = 0; tfinal = 100; y0= [0.5;0]; [t,y] = o...

3 years ago | 0

Answered
How do I fix this interpolation error
You can only inverse interpolate if your vector "exprmentresult" is strictly increasing or strictly decreasing. Since it contain...

3 years ago | 0

Answered
code is right but can not the a plot
If you compare size(t) and size(u,1), you will find that the number of elements of both vectors are not the same (they differ by...

3 years ago | 1

Answered
The Staff Scheduling Problem,Loops Constraints,
Do you want to enlarge the problem size ? If not, why writing 7 clearly arranged constraints in a complicated loop ? But if you...

3 years ago | 0

| accepted

Answered
Error using odearguments (line 95)
For the code to work, x1 in the commands R1new = interp1(SOC',R1',x1); R2new = interp1(SOC',R2',x1); C1new = interp1(SOC',C1'...

3 years ago | 0

Answered
I want to plot y vs. B
B >= 1 ? B = 1:0.1:10; y = arrayfun(@(B) 2/sqrt(pi)*integral(@(x)x.^0.5./(B*exp(x)-1),0,Inf),B); plot(B,y) grid on

3 years ago | 0

| accepted

Answered
how do i solve this equation using matlab
T = @(x,y,z,t) 2*A*P_max*sqrt(alpha)/(k*pi^(2/3)*r^2)*integral(@(u)1./(1+4*alpha*u.^2/r^2).*exp(-(x^2+y^2)./(r^2+4*alpha*u.^2)-z...

3 years ago | 0

Answered
How can i integrate an array using the trapz function
Use cumtrapz instead.

3 years ago | 0

| accepted

Answered
is the objective function stochastic (-> use something like patternsearch) or deterministic?
Since I add the noise just once a priori to the optimization, my objective function is still deterministic, right? Right, but w...

3 years ago | 0

| accepted

Answered
Solving a system of second order ODE backwards
An example: fun = @(t,y) y; [t1,y1] = ode45(fun,0:0.01:1,1); [t2,y2] = ode45(fun,1:-0.01:0,exp(1)); hold on plot(t1,y1) pl...

3 years ago | 1

Answered
How to create for loop
You see the reason (see above) ? The degree of the denominator is bigger than the degree of the numerator. Thus k1,k2,k3 and k4...

3 years ago | 0

Answered
Why will my multi-dimensional Newton Method not converge?
Your Jacobian is wrong. You didn't specify J(i,i-1),J(i,i+1),J(i,i-N),J(i,i+N). Only computing the diagonal is not sufficient fo...

3 years ago | 0

| accepted

Answered
how to use fsolve for non linear functions with some equations are the same form?
You can solve systems with more unknowns than equations, but in most cases ( as in yours ), the solution will not be unique. Th...

3 years ago | 0

| accepted

Answered
Use Problem-Based Optimize solve the "Or Constraints" problem,which showed in the chapter of "Solver-Based Optimization Problem Setup"
clc,clear prob=optimproblem; x=optimvar('x',2); x0.x=[-0.5,0.6]; fun = exp(x(1)) * (4*x(1)^2 + 2*x(2)^2 + 4*x(1)*x(2) + 2*x(...

3 years ago | 0

| accepted

Answered
Nonlinear curve fitting with summation function
Check again whether fun is correctly defined. I changed ri to rj in the last log expression. % Load data from Excel file data...

3 years ago | 0

| accepted

Answered
Thomas algorithm - tridiagonal matrix
clear cm=1/100; delta = 1*cm; nu=1e-6; Uinf=1; H=2*delta; y=linspace(0,H,40); u=Uinf*erf(3*y/delta); dy=mean(diff(y)); ...

3 years ago | 0

| accepted

Answered
Why the function like (1 - cosd(x)) / cosd(x) doesn't create an vector and can't plot?
%sin und cos in degree sind sind() und cosd() F_rel_a = (R - sind(x))./sind(x) F_rel_c = (1 - cosd(x))./cosd(x) instead of %...

3 years ago | 0

Answered
Error with my MATLAB code
E0 and Es are undefined. syms t s Gs Gt Ks Es Et MSU1 = readtable('Relaxation data.xlsx','Range','A4:E82'); E00 = 8567.19; v...

3 years ago | 0

Answered
lsqcurvefit help: Error using asset. FUN must have two input arguments.
Replace the line v_hat = @(A_v,w_g,w_l) A_v.*exp(-(w_g.^2*k_p.^2)/(16*log(2)) - (w_l.*abs(k_p))./2); by V_hat = @(A_v,w_g,w_l...

3 years ago | 0

| accepted

Answered
In this code, I want to find out slope at every value of x?
The answer doesn't change because of new x/y data: clear all clc x=[10.33 10.331 10.332 10.333 10.334 10.335 10.336 10.337 10...

3 years ago | 0

Answered
How to get complete curves in a plot?
clc clear %discretize the space based on uniform spacing(eta) eta = 0.02; N = 300; %specific the slope of second derivative...

3 years ago | 0

| accepted

Answered
How can I run these codes in a for loop?
for i = 0:4 idx(i+1) = hour(result.HourSeries1)==strcat('0',string(i)); m(i+1) = mean(Climatology1.H1(idx(i+1),:)); e...

3 years ago | 0

Answered
solve constraint optimization problem
x = optimvar('x'); prob = optimproblem; M=[1 x;x 1+2*x]; prob.Objective = norm(M,'fro')^2; prob.Constraints.cons1 = x^2-2*x ...

3 years ago | 1

| accepted

Answered
How to put value from one matrix into another matrix
A = [3:42;rand(1,40)].'; B = [6 45 18 24 33;5 12 17 23 32;4 11 16 22 31;3 10 15 21 30]; result = zeros(size(B)); for i = 1:...

3 years ago | 0

Answered
add conditional constrain in optimization
Define x_it be the decision variable if pump i is active at time t. That means x_it can take values 0 and 1 and equals 0 of pump...

3 years ago | 0

| accepted

Answered
Finding all the positive Roots of non linear equation and plotting the modes
f = @(k) cos(k).*cosh(k)+1; K = 0:0.1:8; plot(K,f(K)) k(1) = fzero(f,[1 4]) k(2) = fzero(f,[4 5]) k(3) = fzero(f,[5 9]) Th...

3 years ago | 0

| accepted

Load more