Answered
Insufficient number of outputs from right hand side of equal sign to satisfy assignment. Error in test14>@(x)[g1(x);g2(x);g3(x)] (line 49) nonlcon = @(x) [g1(x); g2(x); g3(x)
nonlcon has two output arguments, not only one as set in your code: nonlcon = @(x) [g1(x); g2(x); g3(x)]; It will be easiest t...

3 years ago | 0

Answered
How can I solve the following PDE?
MATLAB allows you to integrate backwards in time simply by defininig tspan starting with T and ending with 0. And why do you sa...

3 years ago | 0

Answered
Attempting to solve 2 unknown functions using matrix method
Now you have to solve a linear system A*T = B. If k becomes temperature-dependent, your matrix A becomes dependent on T and you...

3 years ago | 0

| accepted

Answered
I'm trying to compare a cell array to a single vector.
DestinationData = {'ATL','DAL','FFT','JBU','SWA';... 'EWR','UAL','FFT','JBU','NKS';... 'PHL','AAL','FFT','JBU','SWA';....

3 years ago | 0

Answered
1D Finite volume scheme for river flow
Take a look at https://www.clawpack.org/gallery/pyclaw/gallery/sill.html https://www.clawpack.org/riemann/Shallow_water_Rieman...

3 years ago | 0

| accepted

Answered
Function behaves unexpectedly on array inputs. To improve performance, properly vectorize your function to return an output with the same size and shape as the input arguments
f4 = @(x,y) (x.^2-1).^2+(y.^2)-(3*y)+1; instead of f4 = @(x,y) (x.^2-1)^2+(y.^2)-(3*y)+1;

3 years ago | 0

| accepted

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

Load more