Answered
optimproblem does not solve an analytical equation correct
Works for me (see above). Your objective must return the norm of A*x (squared), not A*x.

3 years ago | 0

| accepted

Answered
use symsum for equation forming and solving
The equation is linear in k_d. So collect all terms containg k_d on the left hand side, all other terms on the right-hand side...

3 years ago | 0

| accepted

Answered
Obtain Hessian matrix from a sum of squares expression
Each optimizer expects the unknowns as a vector, not as a 2d-matrix. So choose an arrangement of your unknowns in a vector of s...

3 years ago | 2

Answered
Error in dfdt (line 3)
The code line in the loop must read za(i) = (z(i+1)-z(i-1))/(2*h) instead of za(i) = (z(i+1)-(i-1))/(2*h) And call the funct...

3 years ago | 0

| accepted

Answered
how can i write a code to find maximum error in Lagrange polynomial for given functions?
Choose a fine enough grid x on [0,2], evaluate your function(s) f(x) and the Lagrange polynomial(s) L(x) for the grid points and...

3 years ago | 0

Answered
Can argument validation check if size is at least some value?
b = 1:5; v = size(b,2) >= 4 b = 1:3; v = size(b,2) >= 4

3 years ago | 0

Answered
Variable output as "1x0 empty double row vector" halfway through the program after previous iterations in the for loop has normal output values for the same variables.
It may happen that no peaks can be found: RC = 1:4; V = 1:4; [Peaks, X_Peak_value] = findpeaks(RC, V)

3 years ago | 0

Answered
trying to solve two non-linear simultaneous equations but I had an error figuring out my two unknowns (X(1) &x(2)) , can anyone pls help?
Maybe you divide somewhere by x(1) or x(2) in the definition of your function F (which would result in a division-by-zero in the...

3 years ago | 0

Answered
hello, kindly help, I am getting the following error why?: Error using bvp4c Unable to solve the collocation equations -- a singular Jacobian encountered. Error (line 7)
Your initial guess of [ 0 0] resulted in NaN values for dydt. The code works now, but the results are weird. You should check y...

3 years ago | 0

Answered
Solving differential equation using ode45
Here is the solution of your problem for reference: x = linspace(0,1,25); t = linspace(0,2.5,25); m = 0; sol = pdepe(m,@heat...

3 years ago | 1

Answered
How do I solve this non linear equation that requires user defined inputs for each variable and determine the value of K
syms I I0 Ilim C C0 Kinv eqn = I == I0 + (Ilim-I0)/(2*C0)*((C0+C+Kinv)-sqrt((C0+C+Kinv)^2-4*C*C0)); sol = solve(eqn,Kinv); K ...

3 years ago | 0

| accepted

Answered
Solve function not returning a zero
syms x y a = 3; b = 4; c = 1; d = 2; g = 2.5; eqn = (sqrt((x-a).^2 + (y-b).^2) - sqrt((x-c).^2 + (y-d).^2)).^2 == g.^2; s...

3 years ago | 0

| accepted

Answered
how to right math functions
us = @(t) 4*(t>=0 & t<5) + 2*(t>=5); t = -10:0.1:10; plot(t,us(t),'r')

3 years ago | 0

Answered
Solving a system of differential equation using BVP4C but getting error - "The derivative function ODEFUN should return a column vector of length 4."
Replace your function "freq" by function dYdx = freq(x,Y,kGA,EIeff,rhoAom,rhoIom,Fhydro,Mb) Y0 = Y(1); Y1 = Y(2); Y3 = Y(3);...

3 years ago | 0

| accepted

Answered
SOLVING SYSTEM OF ODEs
Write your three equations in the same independent variable (thus either t or tau). I assume all three equations are written in...

3 years ago | 0

Answered
What does hash X (#X) mean in a system of differential equations solution (dsolve)?
The solution depends on the roots of a polynomial of degree 3. The independent variable of the polynomial is denoted by #X. If ...

3 years ago | 0

| accepted

Answered
Unable to solve the collocation equations -- a singular Jacobian encountered.
You have an ODE that has a singularity at x=0. Further, solving for D2y leads to two different differential equations. You must ...

3 years ago | 0

| accepted

Answered
Implementation of 4-step Runge-Kutta
Change the order of the input arguments for f: f = @(t,y) ... instead of f = @(y,t) ...

3 years ago | 1

| accepted

Answered
How to perform integration for the following condition?
alpha= (1 + (((H-Z)/H)*(fa-1)))*Kh*sin((2*pi/T)*(t-(H-x_d)/Vs_S)); m = @(z)Gamma*(H-z)*(tan(Beta)+cot(alpha)); K = @(z) alpha*...

3 years ago | 0

Answered
How to solve symbolic function
syms t ap eq=(ap^2*t^3)/2 - ap*t^3 + (ap*t^2)/2 - t^3/2 + t^2/2 + (127*t)/8 - 8 sol=solve(eq==0,'ReturnConditions',true,'MaxDe...

3 years ago | 0

Answered
I am trying to use Events option in ode45 for my program , please help!
Replace val=y(:,3)-1315; by val=y(3)-1315;

3 years ago | 0

Answered
Solving a PDE using PDE Toolbox
C.ri = 0.0125; C.ro = 0.0375; C.alpha = 1.905*10^-5; C.Ti = 673; C.T0 = 573; r = linspace(C.ri,C.ro,50); t = linspa...

3 years ago | 0

| accepted

Answered
Solve linear equation in matrix form
Why don't you use pi0 = null((A0+R*B).'); if ~isempty(pi0) pi0 = pi0.'/(pi0.'*inv(I-R)*e) end

3 years ago | 0

Answered
determine the reaction parameter using regression method. i need to know about n, E, A
If you take the logarithm on both sides of your rate equation, you get a linear regression problem. Use \ to solve for the unkno...

3 years ago | 0

Answered
ODE45 to solve multiple degree of system free vibration
Maybe you mean m1=10; m2=10; m3=10; m4=10; k1=50; k2=50; k3=50; k4=50; M=[m1 0 0 0;0 m2 0 0;0 0 m3 0;0 0 0 m4]; K=[k1+k2 -k2...

3 years ago | 1

| accepted

Answered
How to run please this example perfectly to get optimal solution .. Thank you
f = [0 ; -10 ; 0 ; -6; -20] ; A = [1 0 0 0 0 ; 0 1 0 0 0 ; 0 0 1 0 0 ; 0 0 0 1 0 ; 0 0 0 0 1] ; B = [...

3 years ago | 1

Answered
How to normalize plot?
x0 = -.02:0.001:.02;lambda=532*10^-9; y0 = -.02:0.001:.02;w0 = 0.002; omegax=1;omegay=2;zr=pi*w0^2/lambda; m = 2; s=1;k=0.00...

3 years ago | 0

Answered
How to Double integrate cell of array containing cell of array?
Works. If your problem is more complicated, you will have to include the code as plain text (no graphics) in order to see where ...

3 years ago | 0

Answered
How to produce Gaussian random variable between two vectors ?
sr = [1,2,2,2,3,3,3,4,5]; % various possible source for i = 1:numel(sr) pd{i} = makedist('Normal',0, sqrt(2)); %generate Gau...

3 years ago | 0

| accepted

Answered
Solving Non-Linear Equations in Matlab by Iteration
First step: Give numerical values to all variables except "taf" Second step: Plot dhO2out+dhN2out+dhCO2+dhH2O - sum (v10) as...

3 years ago | 1

| accepted

Load more