Answered
Integration using BVP4C
close all clc p=1; P1=2; P2=2; b1=0.00021; b2=0.000058; S1=0.005; S2=580000; G1=2; m2=20; R1=997.1; R2=3; C1=1; R3...

3 years ago | 0

| accepted

Answered
Obtained true when false
In the output, the number is rounded to 1.00000... . But this does not mean that the original number cannot be < 1.

3 years ago | 1

Answered
I want to solve a optimization problem [minimization of 2- Norm ], constrains are continuous and binary variables which are linear form. which optimizer solver i need to use?
Since k is a scalar, use prob.Objective =k; instead of prob.Objective =sqrt(sum(k.^2)); This will result in "intlinprog" ins...

3 years ago | 1

Answered
Unable to perform assignment because the left and right sides have a different number of elements.
Execute the code after changing for k = 1:2 h(k+1) = -r(1:k)'*inv(toeplitz(R(1:k))); % Levinson-Durbin recursion end to ...

3 years ago | 0

Answered
summation of matrix function
s = m(1,1)+m(2,2)+m(3,3)+m(4,4)

3 years ago | 0

Answered
How to solve system of ODE's with Boundary Conditions using BVP4C? (I would be very helpful for you)
M = [0 0.5 1 1.5 2]; for i = 1:numel(M) bvpfcn = @(x,y)[y(2);y(3);-y(1)*y(3)+y(2)^2+M(i)*y(2);2*y(3)+2*y(1)*y(2)]; bc...

3 years ago | 1

| accepted

Answered
How to plot duffing equation?( Frequency amplitude)
Give values to the parameters of the equation, rewrite the equation as a system of two first-order equations and use ode45 to so...

3 years ago | 0

Answered
Complex equation in MATLAB (control engineering)
Seems there are several solutions. Use [w_D T_t] = vpasolve(eqns,[w T],[1 1]) instead of [w_D T_t] = vpasolve(eqns,[w T]) ...

3 years ago | 1

Answered
Iterations until condition is met
ER = 50; gamma = 1.4; M = 1:0.00001:10; expr = (1./M) .* ((2/(gamma+1))*(1+((gamma-1)/2)*(M.^2))).^((gamma+1)./(2*gamma-2)) -...

3 years ago | 1

| accepted

Answered
how can I solve the problem Bellow with a three coupled PDEs , knowing that thoses equations represent the energy heat balance of a thermal energy storage system?
Choose a grid in x and r direction. Replace the spatial derivatives by finite difference approximations in the grid points. Inco...

3 years ago | 0

| accepted

Answered
optimization problem with interdependent variables
Use "fmincon". The primary optimization variable is k. Specify the lower bound for k to be 0 in the variable "lb". The object...

3 years ago | 0

| accepted

Answered
Detecting an error in Muller method.
The argument of the root in the calculation of x2 must become negative. Or simply start with complex values for x1,x2 and/or x...

3 years ago | 0

| accepted

Answered
Stability analysis of a non-linear ODE system
You won't succeed in this generality. To determine the eigenvalues, MATLAB had to solve for the roots of a polynomial of degree ...

3 years ago | 0

| accepted

Answered
error when trying to run fit function
Seems you gave your script the name "mpower.m". This conflicts with the built-in MATLAB function with the same name. Rename ...

3 years ago | 0

Answered
How to repeat a vector over and over?
a = rand(1,1023); a = repmat(a,1,ceil(50000/1023)); a = a(1:50000)

3 years ago | 1

Answered
Plotting a summation with two variables
t = linspace(0,0.1,100); x = linspace(0,1,100).'; n = 1000; f = @(t) sum(6./(pi+6*(0:n)*pi).*sin(x.*(0:n)).*exp(-(pi/6+(0:n)*...

3 years ago | 0

| accepted

Answered
How can I perform a summation of a freqz function
syms z k F = @(a) symsum(z^(-k),k,0,a); F(2)

3 years ago | 0

| accepted

Answered
using lsqnonlin with constraints
% A=2*(c(1)+c(2))==u this is the constraint i want to use Then optimize with one parameter c(1) and insert c(2) = u/2 - c(1) f...

3 years ago | 0

| accepted

Answered
Finding the truncation error in an infinite sequence
How can I speed up the calculation by determining the dynamic level where error can be reduced to the barest minimum? You mean ...

3 years ago | 1

Answered
Euler's Method with multiple step sizes
%%% Define the interval [a,b] and initial condition a = 0; b = 0.5; y0 = 1; %%% Find the approximated solution using Euler's...

3 years ago | 0

| accepted

Answered
How Do I Plot 24 equally distanced points (from 0<t<5, inclusive) that agree with an exact solution to an IVP? (RK4/Runge Katta Method)
Use scatter([t 5/24 10/24 15/24 20/24 25/24 30/24 35/24 40/24 45/24 50/24 55/24 60/24 65/24 70/24 75/24 80/24 85/24 90/24 95/24...

3 years ago | 0

| accepted

Answered
How to solve multiple independent equations stored in one variable
for i = 1:numel(b) for j = 1:numel(M0) eq = x^2 - (tunnel.A(i)./Aster(j)*x).^2+2 == 0; tunnelM = solve(eq, x, "...

3 years ago | 0

| accepted

Answered
Matrix problem n*n
n = 3; A = reshape(1:n^2,n,n).'

3 years ago | 0

| accepted

Answered
Not enough input arguments in lsqcurvefit function
x0 = 0 not x0 = [0 0] since k seems to be a scalar as you treat it in "calcor". Further I guess k= lsqcurvefit(@calcor,x0,...

3 years ago | 1

Answered
optim.problemdef.OptimizationProblem/solve SOLVE requires a non-empty initial point structure to solve a nonlinear problem.
My advice is: Do what the error message tells you to do and supply an initial point structure to make MATLAB happy. initial.e =...

3 years ago | 0

Answered
how to remove error form BVP4C code
The odes you want to solve cannot be defined in two separate ODE functions. If you want to solve two differential equations sim...

3 years ago | 0

| accepted

Answered
fplot showing different curve to plot
plot(p_a,Q) instead of plot(Q,p_a): M = 100; p_b = 2; Q = @(p_a) M./(p_a + p_b); hold on fplot(Q, [0 35]) ylim([0 ...

3 years ago | 0

| accepted

Answered
Numerical solution to a larger equation.
What is the zero of your choice ? fun = @(lamda2)sinh(5.9605e-08*(((1.1259e+15*lamda2^2 + 7.5126e+15)^2)^(1/2) + 7.5126e+15)^(1...

3 years ago | 0

Answered
What is wrong with my code, my equation is vdv/dy=-G*M/(y+R)^2 ?
syms G M R y v(y) Dv = diff(v,y); eqn = diff(v,y,2) == -G*M/(y+R)^2; cond = [v(0)==100,Dv(0)==0]; sol = dsolve(eqn,cond) Gn...

3 years ago | 0

Answered
How to compare elements of two vectors in MATLAB ?
A = [1 2; 3 4]; B = [1 4; 3 5]; sum(A(:)~=B(:))

3 years ago | 0

| accepted

Load more