Answered
Find which columns have duplicates
Transpose the matrix :-) Or: ColumnsWithDuplicates = find(arrayfun(@(i)(~isequal (length (unique (A(:,i))), size(A,1))), 1:siz...

4 years ago | 0

Answered
Multiple 3d random walks
lambda = 3; %Mean free path numberOfSteps = 10000; % Total number of steps numberOfPaths = 3; % Number of paths x(1,:) = ra...

4 years ago | 1

| accepted

Answered
Laplace Inversion Of Bessel Function
Try the numerical way of finding the inverse Laplace transform: https://de.mathworks.com/matlabcentral/fileexchange/39035-numer...

4 years ago | 0

| accepted

Answered
Error using / .
If T is an array of multiple temperatures, you have to use elementwise division: k = k0 * exp((-Q) ./ (R*T)) instead of k = k...

4 years ago | 0

Answered
How to implement this coupled ODE
clc,clear,close all global Ve Cd A_r g g = 9.8; % m/s^2 Cd = 0.47; r = 3.7; % m A_r = pi * r^2; rho_fuel = 1000;...

4 years ago | 0

Answered
Solving ODE with boundary conditions
You have a first-order ODE. For first-order ODEs, you can prescribe one boundary condition, not two. Or one of the parameters ...

4 years ago | 1

Answered
Help with non linear equations.
fun = @(x)[8.07-(x(1)-x(2)+x(2)*0.9^(-1/x(3)));11.82-(x(1)-x(2)+x(2)*0.5^(-1/x(3)));284.23-(x(1)-x(2)+x(2)*0.1^(-1/x(3)))]; x =...

4 years ago | 1

| accepted

Answered
Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.
k1=180; k2=50; k3=220; knew=linspace(k1*0.4,k1*1.6,20); m1=1.1; m2=3.4; for i=1:length(knew) K{i}=[knew(i)+k2,-k2;-k2,...

4 years ago | 0

Answered
How do i plot two graphs in the same figure without it telling me that the vectors must be the same length?
Use figure; scatter(Stroom,Spanning_fit); hold on Stroom1 = 0:5:140; Spanning_fit = Stroom1*...

4 years ago | 0

| accepted

Answered
Passing arguments through a function
x = -5:1:5 disp(TopFunction(@(x)lin(x,1,2),x)) disp(TopFunction(@(x)square(x,1),x)) function y = TopFunction(func,x) y = f...

4 years ago | 0

Answered
Why is my code showing output as an array instead of single value?
If your inputs and the variable t are scalar values, A cannot be an array. My guess is that you specified t as a vector. %A ch...

4 years ago | 0

Answered
error because "pkg load symbolic"
In MATLAB, you don't need to load a package: pkg load symbolic This is an octave command. In MATLAB, either you have a licenc...

4 years ago | 0

Answered
solving system of non-linear equations for array of variables gives 0x1 syms
The numerical solver does not find a solution. Are you sure a solution exists ? epsilon0 = rand(3,1); P = 0.05; options = op...

4 years ago | 0

Answered
Why does .* create a matrix when multiplying a row vector by a column vector
Why does this happen? After some reading I learned matlab has 'implicit expansion' which is what I assume is happening. But I gu...

4 years ago | 1

Answered
using a Monte Carlo simulation with 100,000 trials to find the probability of a random integer that is larger than the other random integer in [4,21]
A > B, and A >= B. I think the right code is supposed to plot a figure with a blue line and a red line, and there should be 100,...

4 years ago | 0

Answered
Controlling state transition using transition probability matrix in Markov chain?
I understood that if my current state is 2 and if transition probability is 0.4 then from TPM my next state will also be 2. Th...

4 years ago | 0

Answered
gamultiobj constraints without any mathematical relation with variables
Use an output function "OutputFcn" specified in the options structure of the solver. Within this function, you can calculate "a...

4 years ago | 1

Answered
fzero not working with nested functions and mvncdf
r = 0.03; d = 0.06; sigma = 0.2; V0 = 100; L = 40; VB = 0.6*L; TL = 10; T = 1; a = (r - d - sigma.^2./2)./(sigma.^2); K...

4 years ago | 0

| accepted

Answered
strange solution of an equation by Symbolic Toolbox
A MATLAB error. A second "solution" is computed that does not solve the equation. MATLAB needs to square your equation several...

4 years ago | 0

Answered
Find minimum value of a function with 4 parameters
distanceAntenes = @(x) -sqrt((x(3)-x(1))^2+(x(4)-x(2))^2); x = fmincon(distanceAntenes, [5 6 3 7],[],[],[],[],[0 0 0 0],[10 10 ...

4 years ago | 0

Answered
I have a line of experimental data and need to plot confidence interval
N = size(y,2); instead of N = size(y,1);

4 years ago | 0

Answered
does anyone know how to solve these two problems?
One way to solve the two problems: https://de.mathworks.com/help/symbolic/sym.piecewise.html

4 years ago | 0

Answered
Arrays have incompatible sizes for this operation
You should look up characters and if-statements in the documentation. clc; clear; %This function is will determine the rate o...

4 years ago | 1

Answered
How to take the sum of a series of variables to a limit?
What's the underlying function with these Fourier coefficients ? %% Fourier coefficients a_(10) = (6)/(20*pi)*exp(pi/2); a_(9...

4 years ago | 0

Answered
Use Ode 45 in Chua's system with non linear function need to be solved but I don't know how iterate the non linear function in loop?
[t,x] = ode45(@chua_function,[0 150],[0.1 0.1 0]); plot3(x(:,1),x(:,2),x(:,3),'r') title(" Chua's circuit") xlabel('x') ylab...

4 years ago | 1

| accepted

Answered
Finding the root of a function between an interval
format long y = @(x) 1 - sin(x); z = @(x) x.^2; test1 = @(x) y(x)-z(x); x = fzero(test1,[0 1])

4 years ago | 0

| accepted

Answered
Creating a script with multiple conditions and equations
T = @(T_ute) (36.44 - 0.64*T_ute).*(T_ute<-4) + 39*(T_ute>=-4 & T_ute<=4) + (43.26 - 1.06*T_ute).*(T_ute > 4 & T_ute <=21) + T_u...

4 years ago | 0

Answered
Some Problems related to linear equation and elliptic equation
syms a b x y k m eqn1 = x^2/a^2+y^2/b^2==1; eqn2 = y==k*x+m; eqns = [eqn1 eqn2]; [x,y] = solve(eqns,[x,y]) P1 = [x(1),y(1)...

4 years ago | 1

| accepted

Answered
Solving linear system with constraints
x0 = 2; sol = fmincon(@obj,x0,[],[],[],[],[],[],@nonlcon) function value = obj(x) value = -x; end function [c, ceq] =...

4 years ago | 1

Answered
Euclidean distance between the rows of the matrix and the vector
A = rand(30,4800); B = rand(1,4800); C = sqrt(sum((A-B).^2,2))

4 years ago | 0

Load more