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...

3 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,...

3 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...

3 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...

3 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...

3 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...

3 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 ...

3 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);

3 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

3 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...

3 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...

3 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...

3 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])

3 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...

3 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)...

3 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] =...

3 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))

3 years ago | 0

Answered
How can I calculate vector relative errors in percent?
x = rand(100,1); ms = mean(x); vs = var(x); relative_error_ms_in_percent = abs(ms-0.5)/0.5 * 100 relative_error_vs_in_percen...

3 years ago | 0

Answered
Solving a Delay Differential Qquations that involves a mass matrix
Write out your system and you will find that x3 = x6 = x7 = x8 = x9 = 0 and you are left with the equations x1(t) = sin(2*pi*...

3 years ago | 0

Answered
I have differnt coodinate after use fmincon
x0=[0 0]; lowerbound =[-1 -1]; upperbound = [1 1]; sol = fmincon(@distance,x0,[1 1],2,[],[],lowerbound,upperbound) functi...

3 years ago | 0

Answered
How to plot the diffusion curve for different timesteps?
Save C in the loop for the values of t where you want to plot the curves. You should get a matrix like C(ntimes,nx). Then outsi...

3 years ago | 2

Answered
Calculation of the center of mass of a cone
https://de.mathworks.com/matlabcentral/answers/1849928-how-can-i-find-solid-cone-center-of-mass?s_tid=srchtitle

3 years ago | 0

Answered
Create a function that will return the cdf at any given point to implement the bisection code.
syms c x real f = c*exp(-x.^3); cnum = solve(int(f,x,0,Inf)==1,c); f = subs(f,c,cnum); F = int(f,0,x); F = matlabFunction(F...

3 years ago | 0

| accepted

Answered
Using the right values for the variables, function gives a completely wrong answer
You forgot that 17.523 is multiplied by pi in the calculation of L.

3 years ago | 0

| accepted

Answered
I am trying to code a solution to blasius eq using Runge kutta 4, help please.
clear all; clc; % 3 First order ODE“S from Blasius Eq % dF/deta = G % dG/deta = H % dH/deta = -0.5*F*H fF=@(eta,F,G,H) ...

3 years ago | 0

Answered
How to determine the absolute value of a complex exponential function containing a symbolic variable?
syms omega t real syms I0 positive I = I0*exp(1i*omega*t); abs(I)

3 years ago | 0

Answered
Second degree differential equation
The example Solve Nonstiff Equation under https://de.mathworks.com/help/matlab/ref/ode45.html explains in detail how to proc...

3 years ago | 1

| accepted

Answered
Unable to perform assignment because the size of the left side is 1800-by-1 and the size of the right side is 4872-by-1.
Anything unclear about the error message ? rxBits has only 1800 rows, but qamdemod(rcomb, 2^bitsinreceiver, 'OutputType', '...

3 years ago | 0

Answered
3D cylinder code debugging
zSC_lid is an 1 x nNodes vector: zSC_lid = repmat([0, hSC], 1, nNodes); Thus it has only one row. But you reference the secon...

3 years ago | 1

Answered
Different output for find(X) and find(X<5)
find(X) lists the array elements of the double array X that are not equal 0. find(X>0) lists the array elements of the logical ...

3 years ago | 1

Load more