Answered
Solving PDE and ODE coupled system with varying boundary conditions?
If you want to change a boundary condition, use a second function "fun" and call ode15s with the solution obtained so far and th...

2 years ago | 0

| accepted

Answered
2 second order differential equations with boundary conditions using bvp4c
Almost the same code as in the preceeding problem: % Parameters alpha = 0.001; gamma = 100; epsilon = 1; delta_v = 0.1; a=...

2 years ago | 1

Answered
Fitting two curves with shared parameters to two datasets
clc close all clear all set(0,'defaulttextinterpreter','latex') set(0,'defaultAxesTickLabelInterpreter','latex'); set(0,'de...

2 years ago | 0

| accepted

Answered
ODE15s Unable to meet integration tolerances without reducing the step size below the smallest value allowed
If you store P for 1:Nx and m for Nx+1:2*Nx, you should also return dPdt for 1:Nx and dmdt for Nx+1:2*Nx. But you return dPdt fo...

2 years ago | 1

Answered
Why is my multi-objective optimization with gamultobj (NSGA-II) not working?
Extract your optimization parameters at the time when the integrator returns NaN values. Are they reasonable ? If you think they...

2 years ago | 0

| accepted

Answered
Interior-point and sequential quadratic programming give me the same answer. Is there an error with my code?
I just saw in your code that you don't pass the options structure to fmincon. Thus in both calls, the same solver is used. Use ...

2 years ago | 0

| accepted

Answered
How to calculate first and second derivative for concentration?
It seems the concentrations are solutions of differential equations, thus something like dy/dt = f(y,t). So you can see that af...

2 years ago | 0

Answered
How can I get a loop within a loop to return a value as a matrix?
Maybe you mean B = -0.388; C = -0.026; P = 1.2; T = 305:5:550; R = 8.314; V9 = mvolume9(B,C,P,T,R); disp(V9) function ...

2 years ago | 0

Answered
Need Help With Function Creation and Integration
I'll assume that all variables except y0 are scalars and defined somewhere before in your code. In this case, use ua = integra...

2 years ago | 0

Answered
Solving a second order nonlinear differential equation with this boundary condition: y'(0) = 0, y(1) =1
The shooting method can be used for any combination of boundary conditions at x=0 and x=1. In your case, you have to estimate y...

2 years ago | 0

| accepted

Answered
1D Heat equation in Matlab with variable heat Flux at one side
You are doing numerics here. The maximum difference is 1e-13, I think this is acceptable: pdepeSolverTest() function pdepeSo...

2 years ago | 0

| accepted

Answered
Why am i getting blank plots
The solution for all four solution variables is NaN (see above) - most probably caused by the use of "log" in "theta_lm1" and "t...

2 years ago | 0

Answered
quadgk problems “Output of the function must be the same size as the input.”
Your functions cannot be vectorized for the below setup because they will be called with vectors for r, r_hat and theta of diffe...

2 years ago | 0

Answered
How do i fix my newtons method code?
fx and df are not function handles in your code. So you must use "subs" to evaluate them at a certain x-value. And setting x0 =...

2 years ago | 2

Answered
Symbolic function Gaussian Beam
w0 and z0 are function handles. You can't use them like variables in your definitions. Further, E is a complex-valued function....

2 years ago | 0

Answered
How to extrapolate the first 5 points
p = load("points.mat"); px = p.points(:,1); py = p.points(:,2); [~,idx] = sort(px); px = px(idx); py = py(idx); plot(px,py...

2 years ago | 0

Answered
How to perform recursive integration
syms a b x t positive syms F0 f(x) = b/a*(x/a)^(b-1)*exp(-(x/a)^b); F0(t) = 1; F1(t) = int(f(x)*F0(t-x),x,0,t) F2(t,x) = f(...

2 years ago | 0

Answered
Quadratic Objective with two Quadratic Constraints
What about function [y,yeq,grady,gradyeq] = quadconstr(x,B,C) y = []; yeq(1) = x.'*B*x - 1; yeq(2) = x.'*C*x - 1; i...

2 years ago | 1

Answered
Using Optimizing Nonlinear Functions to find mutiple variations
xdata=[125 127 129 131 133 135 137 139 141 143 145]; ydata=[0.002 0.003 0.009 0.025 0.053 0.089 0.104 0.09 0.07 0.041 0.017]; ...

2 years ago | 0

| accepted

Answered
matlab code for 2nd order differential equation with boundary conditions
You have a boundary value problem, not an initial value problem. ode45 is not suited in this case. Use bvp4c or bvp5c instead. ...

2 years ago | 0

Answered
Matlab code: deflection of simply supported beam using ode45
Hi, my code keeps returning a function for a cantilever beam rather than a simply supported. How do I fix this?? By using bvp4c...

2 years ago | 0

Answered
Solving a system of ordinary differential equations
It's just the starting phase where you observe a linear profile (see below). tspan = [0 60000]; %timespan y0 = [0.0675 0.0075...

2 years ago | 0

Answered
nonlinear constraint game theory
By the way: What do you mean by "nonlinear constraint game theory" ? Your constraints are all linear. % Define the objective fu...

2 years ago | 1

Answered
Solution of nonlinear ordinary differential equation of second order
I suggest you integrate the equation y" = A (x^4) twice with respect to x and adjust the two free constants from the integrati...

2 years ago | 1

Answered
The output of solve(eqn, x) is still an equation instead of number
Use G2 = double(solve(subs(equation1))) instead of G2=solve(equation1,G2)

2 years ago | 1

Answered
Finding column index for matching values in a matrix
poschannel = [1 3 -5;0 3 4;-1 1 9]; rows_with_1 = arrayfun(@(i)any(poschannel(i,:)==1),1:size(poschannel,1)) or shorter rows_...

2 years ago | 0

| accepted

Answered
Help with fmincon Optimization for a Function Involving Matrices in MATLAB
y = 3; if y > 1 & y < 5 obj = @(p)0.5*p(1)*p(2)+0.34*p(3); nonlcon = @(p) deal([],p(4)-p(1)*p(2)*p(3)); A = [0 0...

2 years ago | 0

| accepted

Answered
Energy method with Hermite cubic function (2 essential condition)
m and nv are inputs to the function "ex_enerHermite". Where do you set these values and where do you call the function ?

2 years ago | 0

| accepted

Answered
Conversion from ellipsoidal to geocentric cartesian
I don't think that you need iteration. The 5 steps for conversion are given in the section "Algorithm" under https://uk.mathwor...

2 years ago | 0

| accepted

Answered
Extract columns and rows from matrix
first = rand(5) second = rand(5) second(5,:) = first(:,1).'

2 years ago | 0

| accepted

Load more