Answered
Index exceeds the number of array elements. Index must not exceed 1.
You use Em(k) and Em * (k) in this line of code. Both cannot be correct, I guess. Further check out whether E(k) is correct: E ...

3 years ago | 0

| accepted

Answered
How can i use different solvers like ga, patternsearch, particle swarm etc in problem based Mixed integer Linear Programming
MATLAB chooses the solver that is most appropriate (usually means: fastest) for your problem. Why solving a linear optimization...

3 years ago | 0

Answered
Non trivial solution to a linear system
However whenever I use the A\B command to solve the system I get the trivial solution x=[0 0 0 0 0]' and I am told that this sol...

3 years ago | 0

Answered
How do I mulltiply a complex conjugate vector by its second derrivative (also complex) to get a real number?
I don't know why psi*psi'' should be real, but here is a method to avoid shortening "psi". psi = [0.0100 + 0.0172i 0.0106 + 0...

3 years ago | 0

Answered
How do I get these two equations to work in scenarious like this
As far as I know, MATLAB won't perform algebraic manipulations before substituting variables or algebraic expressions. As an ex...

3 years ago | 0

Answered
Need help debugging code
Your input matrix is missing in the call.

3 years ago | 0

| accepted

Answered
Index exceeds the number of array elements (24)
Delete the line for t=t+1 and the corresponding end And why do you set P_pv1 = 270; P_pv2 = 140; P_pv3 = 120; P_pv4 ...

3 years ago | 0

Answered
combining varying uneven matrices
m = min(size(A,1),size(B,1)); A = A(1:m,:); B = B(1:m,:);

3 years ago | 0

Answered
Unable to assign a vpasolve result from a for loop
For D = 0, there is no solution for k. And why do you solve for H0_t3 ? If Hb does not depend on H0_t3, the equation for H0_t3 i...

3 years ago | 0

| accepted

Answered
possible to reduce the relative difference for CheckGradients in optimization (fmincon)?
Why not just turning off the CheckGradient feature if you are sure your derivatives are correct within a certain error tolerance...

3 years ago | 0

Answered
How to color the space between ellipse?
v = -6:0.001:6; % plotting range from -5 to 5 [x y] = meshgrid(v); % get 2-D mesh for x and y cond1 = x.^2 + y.^2/4 >= 1; %...

3 years ago | 0

Answered
How to plot each term of a sum?
The curves seem to be almost identical. y_p = [0.478 3.218 6.322 9.451 12.586 15.724 18.863 22.002 25.143 28.283 31.424 34.565 ...

3 years ago | 0

| accepted

Answered
How do I apply an operation to certain elements in a row vector (that are less/more than a given value)
for k=1:A for i = 1:numel(x) if (0 <= x(i)) && (x(i) <= Va(k)) Q = Vb(k)*(1-(Va(k)/L))*x(i); el...

3 years ago | 0

| accepted

Answered
Matlab Matrix calculation coming wrong
% Strain calculation gauge1 = [700;300;500;500]; gauge2 = [700;300;300;700]; gauge3 = [300;700;700;300]; fig = figure; su...

3 years ago | 0

Answered
How to find minimum value and its corresponding variables for a large dataset?
@Kishore Write a function that returns Kpe1 given delta1, theta1, kh, kv and alpha1. Then you can vary the independent variable...

3 years ago | 0

Answered
'sym' returns val = k11
As you can see, there are 36 equations for 12 variables. A solution only exists that approximately satisfies the equations. sym...

3 years ago | 0

| accepted

Answered
Matrix distribution into two vectors that build similiar matrix as a vector product
But you already got the answer for the two vectors a and b and the resulting approximating matrix C: [u s v] = svd(M); n = 1; ...

3 years ago | 0

Answered
Piecewise Function Surface Plot
Hint: The function can be defined as fun = @(x,y) (2*x+2*y^2)*(x+y^2>=0 && x+y^2<=1) + (x+y^2+2)*(x+y^2>1 && x+y^2<=2);

3 years ago | 0

Answered
why do I receive ode15s error?
clc clear close all %Data k = 247; % W/mK rho = 2710; % kg/m^3 Cp = 900; % J/kg...

3 years ago | 1

| accepted

Answered
how can I plot graph of differential equations with matrix?
No mistake. MATLAB is simply not able to find an analytical solution. Instead of "dsolve", use a numerical ODE integrator, in th...

3 years ago | 0

Answered
How to find minimum value and its corresponding variables?
Add the following two lines at the end of your code: [~,idx] = min(Results(:,5)) all_values = Results(idx,:)

3 years ago | 0

| accepted

Answered
How do I get the second solution?
Pr = 1; %fixed lambda =-1.1; %mixed convection parameter (lambda) a = 0; b = 10; % b = infinity solinit = bvpinit(linspa...

3 years ago | 0

Answered
loop on matrix array
The following code computes the distance between the columns of M. M = [0 3 -1 4 6 13 -2 0 4]; D = squareform(pdi...

3 years ago | 0

Answered
fitlm - only positive coefficients
Use "lsqlin" instead. Here, you can set upper and lower bounds for the parameters.

3 years ago | 0

Answered
ODEs with Structs in codes
What is the dimension of Tdata ? And what are your Tdata ? %%%input as an array of structs for fixed value variables input.v_z...

3 years ago | 0

| accepted

Answered
How to divide a polynomial into two polynomials, one with the odd coefficients of w and the other with the even coefficients of w?
Odd part: (P(w) - P(-w))/2 Even part: (P(w) + P(-w))/2 syms w kd ki kp P(w) = 25*ki - w^4*(kd + 1) + w*(25*kp - 1)*1i + w...

3 years ago | 1

| accepted

Answered
How can I solve this?
syms PL c k eqn1 = PL * exp(-c*exp(-k*0)) == 179323; eqn2 = PL * exp(-c*exp(-k*10)) == 203302; eqn3 = PL * exp(-c*exp(-k*20)...

3 years ago | 0

Answered
How to compare the complexity of two algirthms in MATLAB
Count the number of arithmetic operations used by both depending on the input. E.g. usual matrix multiplication needs m*n*o mul...

3 years ago | 1

Answered
Computing a differential equation using a bessel function.
The solution y of this differential equation is a combination of J_0(x) and Y_0(x), the Bessel function of the first and second ...

3 years ago | 0

| accepted

Load more