Respondida
How to make a tridiagonal matrix (N-1)*(N-1), with different values in the first row?
Change the two values manually after you created A with the "standard" diagonal vectors. A = ...; A(1,1) = A(1,1) + 4/3; A(1,...

alrededor de 3 años hace | 0

Respondida
Sparse matrix x = A/B
Don't post pictures, post your code in plain ascii so that we are able to copy and execute it. Your A in the picture you posted...

alrededor de 3 años hace | 0

Respondida
Why bvp4/5c produces anomalous solution when using parameter passing using anonymous functions ?
Works for me. With each call to bvp5c, the options structure has to be modified because e changes within the loop. e = 1; so...

alrededor de 3 años hace | 0

| aceptada

Respondida
When I run my code, I keep getting this error: "The following error occurred converting from sym to double: Unable to convert expression into double array."
So you have a constant source term int^1_0(y'*x)dx in all grid points - independent of the position x in the interval [0 1] ? ...

alrededor de 3 años hace | 1

Respondida
Error while running "lsqcurvefit" function. "Failure in initial objective function evaluation. LSQCURVEFIT cannot continue."
Before calling lsqcurvefit, try to evaluate your function by fun(c0,xdata) and see what you get. If this evaluation is not pos...

alrededor de 3 años hace | 1

Respondida
Removing vertical lines in a piecewise function when discontinuty points are not known
Maybe something like this. But the jump height of 0.05 at discontinuities most probably has to be adjusted in other applications...

alrededor de 3 años hace | 1

| aceptada

Respondida
Implicit system of ODEs, problem with ode15i
You can explicitly solve for yp - so there is no need to use ode15i. But the Gamma-problem remains. clc; clear all; close all ...

alrededor de 3 años hace | 0

Respondida
Is there a way to take integrals over changing variables? Matlab
As far as I can see from the plots, we get the same results. syms p0 x b zeta real % Calculate lift distribution pz(x) pz = p...

alrededor de 3 años hace | 0

Respondida
Problem using lsqnonlin with a simulink model
Did you study this example: https://de.mathworks.com/help/optim/ug/lsqnonlin-with-a-simulink-model.html ?

alrededor de 3 años hace | 0

| aceptada

Respondida
Solving exact ODE and fplotting a solution curve.
Why do you think sol(1) in your code above gives a trivial solution ? Is y(x) = -exp(x) trivial ? syms y(x) ode = (exp(x + y)...

alrededor de 3 años hace | 0

| aceptada

Respondida
how does fmincon interior-point algorithm deals wtih underdetermined system?
All optimization problems are "underdetermined" in the sense of what you wrote above (i.e. less equality constraints than unknow...

alrededor de 3 años hace | 0

| aceptada

Respondida
remove negative values from one column and the corresponding data in another coloumn
t = linspace(0,1); x = -1+2*rand(size(t)); idx = x<=0; x(idx) = []; t(idx) = []; size(t) size(x)

alrededor de 3 años hace | 1

Respondida
How can I save one of variable in my function ?
After ode45 has finished, just recalculate NOD1 in the calling program for the time vector t: [t,x]=ode45(@odeHar,tspan,x0); ...

alrededor de 3 años hace | 2

| aceptada

Respondida
Definition of the error function in lsqnonlin
Use a function instead of a function handle. p0 = [1 2]; x = 0:1/10000:10 p = lsqnonlin(@(p)fun(p,x), p0); function err = ...

alrededor de 3 años hace | 0

| aceptada

Respondida
I don't know how to make a loop to my System ( System of coupled differential equation) with a heaviside step or square wave ?
ico=10; Vapp=0.6; V_T=1; V_m=.05; la=19.83; Ra=297.5; Rb=1457; Rs=8; Cm=1.2e-8; t_K=la/Ra; t_m=Cm*Rb; T = []; X = ...

alrededor de 3 años hace | 1

| aceptada

Respondida
one error i can not solve plz solve it.
If you check the sizes of vs.' and 1j*2*pi*f_mod*t size(vs.') size(1j*2*pi*f_mod*t) you will see that multiplication...

alrededor de 3 años hace | 0

Respondida
Solving a complicated system of ODEs
You use dydt(5) and dydt(6) before they have been assigned their values: dydt(1) = -dydt(5) - k.*theta1; dydt(2) = -k....

alrededor de 3 años hace | 1

Respondida
Trying to plot 2 variable 3d graph. The z matrix is filled with NaN values only.
TMR = (f_m*(f_Cd*sqrt(2*(f_dP_factor*p_c)/f_d)))./(o_m*(o_Cd*sqrt(2*(o_dP_factor*p_c)/o_d))); instead of TMR = (f_m*(f_Cd*sqrt...

alrededor de 3 años hace | 0

Respondida
How to find the maximum value of two variables of a function in MATLAB
eta = 0.01:0.01:1; x0 = (1:1:100).'; z = 1e6*log2(1+(10^(30/10)*4*(3e8/(4*pi*1e12))^2*15^(-4)*exp(-0.0016*15))/10^(-90/10))*(-...

alrededor de 3 años hace | 0

Respondida
Updating of boundary condition during bvp4c solution procedure
In bvp4c, your boundary conditions at xl = xstart and xr = xend can take the form fl(xl,psil) = 0 and fr(xr,psir) = 0 where fl a...

alrededor de 3 años hace | 0

| aceptada

Respondida
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.

alrededor de 3 años hace | 0

| aceptada

Respondida
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...

alrededor de 3 años hace | 0

| aceptada

Respondida
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...

alrededor de 3 años hace | 2

Respondida
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...

alrededor de 3 años hace | 0

| aceptada

Respondida
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...

alrededor de 3 años hace | 0

Respondida
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

alrededor de 3 años hace | 0

Respondida
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)

alrededor de 3 años hace | 0

Respondida
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...

alrededor de 3 años hace | 0

Respondida
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...

alrededor de 3 años hace | 0

Respondida
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...

alrededor de 3 años hace | 1

Cargar más