Answered
Why do I have an error with minus sign
There is a minus sign in front of d^2M/dx^2 which is difficult to see. So everything is ok: f_0*(x/L)*(1-(x/L)) = -(f_0*x*((x/L...

2 years ago | 1

Answered
Out of memory - dsolve 3rd order system
Does this one work better ? syms t y1(t) y2(t) y3(t) f = 10*exp(-t); eqn1 = diff(y1) == y2; eqn2 = diff(y2) == y3; eqn3 = d...

2 years ago | 0

Answered
Solve these unkowns x and y using these 2 simultaneous equations
I think you want to use sind and cosd instead of sin and cos. This is a linear system of equations in m3R3L3 and m4R4L4. You kn...

2 years ago | 0

Answered
How do I include or make a discrete variable for an optimization problrm?
Make a loop over the 4*4*3*3 = 144 possible combinations of x1,x2,x3 and x4 and only optimize with respect to x5, x6 and x7. In...

2 years ago | 0

Answered
I want to solve these 2 simultaneous equations to get x and y
syms x y equ1 = 73*sind(0)+92*sind(200)+87*sind(x)+65*sind(y) == 0; equ2 = 73*cosd(0)+92*cosd(200)+87*cosd(x)+65*cosd(y) == ...

2 years ago | 0

| accepted

Answered
i was calculate using gauss jacobi method with 4x4 matrice, why does NaN appear? what should i do?
A(2,2) equals 0, but you divide by 0. What is H ? clc; A=[1 3 1 -1; 2 0 1 1; 0 -1 4 1; 0 1 1 -5]; A=[A(2,:);A(1,...

2 years ago | 0

Answered
Index in position 2 exceeds array bounds (must not exceed 25).
Without seeing your data, I'd speculate that spec001 has only 25 columns, but that you try to address columns up to the index 20...

2 years ago | 0

Answered
Problem with time plot from partial derivative equation solved by method of lines
It's "Conversion", not "Convertion". And setting a boundary condition at z = L is incorrect because you only have convection, n...

2 years ago | 0

| accepted

Answered
How do I define piecewise constant function in for loop?
Give the correct values to the arrays "left_limit_of_ith_interval" and "right_limit_of_ith_interval" in the following code: lef...

2 years ago | 2

| accepted

Answered
Runge-Kutta 4th Order on a 2nd Order ODE
Comparing with a MATLAB integrator, the results look ok. I don't know how you derived that "the value of k11 shoud be -0.06 bu...

2 years ago | 0

| accepted

Answered
Changing ode solver tolerances on the fly
Is it possible to change (relax) the values of the "Absolute tolerance", Relative Tolerance" on the fly just for the "problem" t...

2 years ago | 1

Answered
Saving of state just before nonconvergence of ode solvers
The stepsize before the solver exists usually becomes small. So if you choose "tspan" in the call to the ode integrator as a 2-e...

2 years ago | 0

| accepted

Answered
ODE45 not producing outputs test does not finish
Use a stiff integrator, namely ode15s instead of ode45.

2 years ago | 0

| accepted

Answered
Unrecognized function error in bvp4c (in boundary conditions)
A = 2; B = 1.5; g = load('gr_in.mat'); gr = g.gr; rc = gr(:,2); figure(1) plot(gr(:,2),gr(:,1)) N = 100; r = linspace(rc...

2 years ago | 1

| accepted

Answered
Write function for complicated recurrence relation.
I modified your formula slightly, and after this modification, it seems to give correct results: N = 14; L = zeros(N); L(1,1:...

2 years ago | 0

Answered
Fit ellipsoid to (x,y,z) data
https://uk.mathworks.com/matlabcentral/answers/2038016-how-to-plot-the-best-fitted-ellipse-or-circle?s_tid=srchtitle https://uk...

2 years ago | 2

Answered
script no longer works after update to 2023b (related to ode45)
Why do you use ode45 for a boundary value problem ? Use bvp4c instead. The below code doesn't give errors or warnings - at leas...

2 years ago | 0

| accepted

Answered
how to code this type of objective function (optimization)
Use "fminimax" and read the documentation on how to apply the software also for maximizing the minimum instead of minimizing the...

2 years ago | 1

Answered
How to plot the best fitted ellipse or circle?
Compute the center of gravity of the point cloud. Call it (x',y'). Compute the point of your point cloud with the greatest dist...

2 years ago | 1

Answered
Plot Lagrange parabolas for a Simpson's composite rule
clearvars; close all; clc; f =@ (x) 2 + sin((pi/20)*x) + sin((pi/3)*x); x0 = 0;%input("Inferior limit in x to aproximate: ...

2 years ago | 1

| accepted

Answered
Solving system of ODE and PDE in 1D
Except for DTwDt(1) = 293.0; which must of couse read DTwDt(1) = 0.0; it seems the equations as written are correctly implem...

2 years ago | 0

Answered
Error using sym/subs Inconsistency between sizes of second and third arguments.
You cannot subs a vector of size 1x2 for a vector of size 1x3 (see above).

2 years ago | 0

Answered
Find Coefficients of a 5th order ODE without ode45
syms t x(t) Dx = diff(x,t); D2x = diff(x,t,2); D3x = diff(x,t,3); D4x = diff(x,t,4); D5x = diff(x,t,5); eqn = D5x-5*D3x+4*...

2 years ago | 0

| accepted

Answered
How to find mean of sin(t)/t with t [0, pi]?
syms x I = vpa(int(sinc(x),x,0,1))

2 years ago | 0

Answered
Error in fzero usage
bs_price = blackScholes(sigma,S,K,r,T,r,q); function resu = blackScholes(sigma,S,K,r,T,q) Do you see the different number of i...

2 years ago | 0

| accepted

Answered
problem with symbolic factorization with two symbols
Here are the factors: syms s K eqn = s^3 + 10*s^2 + (21+K)*s + 4*K == 0; factors = solve(eqn,s,'MaxDegree',3)

2 years ago | 1

Answered
My while loop only runs once then hits an error
Maybe like this ? % Section 1 clear; clc; n=1; h(n) = 0; v(n) = 0; t(n) = 0; % initial values m = 0.5; % mass of rocke...

2 years ago | 0

Answered
Finding sum of for loop with if else statement
You mean this ? trangeF = 0:0.001:1.6; % Time range xt = zeros(size(trangeF)); for n = -2:2 if n == 0 s0 = 312...

2 years ago | 0

Answered
Solving a system of integro-differential equations
Define dI_n / dt = P1*exp(-lambda_n^2*D_a*t) , I_n(0) = 0 as additional ODEs to be solved. Then I_n = integral_{tau = 0}^{tau...

2 years ago | 0

Answered
"I'm trying to add an 'if' statement to analyze each result, but Matlab is 'ignoring' the condition and not performing the addition."
c is a vector. Do you want d to be rad2deg(theta) + 180 if all elements of the vector c are < 0 ? Then your code is correct. Oth...

2 years ago | 0

Load more