Answered
How to solve and plot system of nonlinear differential equations?
d=0.015; xp1=0.002; xp2=d-xp1; tspan = [0 0.17]; y0 = [xp2 - 0.00000001;0;0]; options = odeset('RelTol',1e-12,'AbsTol',1e-1...

3 years ago | 1

| accepted

Answered
i am not getting what is the problem with it
function good = find_good_hotels(hotels,ratings,cutoff) if ratings>=cutoff Ridx=find(ratings) good=hotels(Ridx) ...

3 years ago | 0

Answered
plot issue 'input function must return single or double value. sym found.'
a = 0.2; %field loss coefficient α[db/km] alfa = a*log(20)/20; gamma = 1.3; % fiber non-linearity coefficient γ[1/w...

3 years ago | 0

| accepted

Answered
9x3 linear (x,y,z must be positive)
A = rand(9,3); b = rand(9,1); sol = lsqnonneg(A,b) Now you can insert your data for A and b.

3 years ago | 0

| accepted

Answered
How to calculate double integral?
n = 1 ; t = 1; r = 1; s = 0:0.2:10; fun = @(x,z,k) x.^2.*exp(-2.*t.*x.^2)./(x.^2+1/r^2).^2 .* z.*exp(2*n*t.*z.^2).*besselj(0...

3 years ago | 0

| accepted

Answered
How to fit data in an array to a multidimensional function?
Generate four 1d column vector X,Y,Z and F of your data where F(i) is the value of your function corresponding to F(X(i),Y(i),Z(...

3 years ago | 1

| accepted

Answered
making a 3d contour
pr = 0.734; n = 1.413e-5; ts = 12; l = 10; w = 4; k =0.02428; V = 10:2:50; To = 0:10; for iv = 1:numel(V) v = V...

3 years ago | 0

| accepted

Answered
Determine positions of projected points onto an ellipse
a = 2; b = 1; % main axes x0 = 1; y0 = 1; % translation alpha = 5; % rotation angle of ellips...

3 years ago | 1

Answered
Generate random numbers with constraints
https://de.mathworks.com/matlabcentral/fileexchange/9700-random-vectors-with-fixed-sum

3 years ago | 0

Answered
pdepe function doesnt stop compiling
You set par.rho*par.g*u(1)^2-par.k2*(par.gamma*(2*par.R1)^-1)*u(1)^(1/2)*dudx(1) = 0 at x=0. Are you sure this is correct ? p...

3 years ago | 0

| accepted

Answered
Solve a nonlinear equation with constrains
p0 = 1000e6; t0 = 1e-6; td = 1e-6; t = t0 + td; c = 7.5e8; a = @(r)log(r)./(t0*(r-1.0)); b = @(r)a(r).*r; func= @(r) ...

3 years ago | 1

| accepted

Answered
3 dimensional interpolation.
Make an interpolation function from your data and call "integral2" with this function as to be integrated within specified limit...

3 years ago | 0

Answered
Why receive Error using sub2ind (line 73) Out of range subscript. Error in sym/subsref?
I hope you know what you are doing ... M=1; a=[1,1,1,1]; b=[1]; h=1; WW = rand(10,10,4,M); W = zeros(10,10,4,M); W = sym(...

3 years ago | 0

| accepted

Answered
Fourier Series, how to properly call the function? it says my left and right sides have different number of elements.
You defined f piecewise in f and flim. With the commands an(n) = (1/T) * int(f*cos(2*n*pi*t/T), flim(1), flim(end)); ...

3 years ago | 0

Answered
sum in function of function itself (recursive)
Works for me: f = @(x)x^2; a = 0; b = 1; e = 1e-4; y = adaptive_quadratur(a,b,e,f) function y=adaptive_quadratur(a,b,e,f) ...

3 years ago | 0

| accepted

Answered
9x3 linear system (least squares)
https://de.mathworks.com/help/matlab/ref/lsqnonneg.html

3 years ago | 1

| accepted

Answered
i need monte carlo simulation of malaga distribution.
Fourth hit if you google your subject as Malaga distribution

3 years ago | 0

| accepted

Answered
Why I'm I getting this error when I try to call the function myfourier in another m file?
Give another name to the MATLAB function created here: fourier = matlabFunction(fs); There is already a MATLAB built-in functi...

3 years ago | 0

| accepted

Answered
Solving four trigonometric equations, four unknowns
It seems that only 4 complex solutions exist. syms phi2 phi3 phi4 r1 eqn1 = 10*cos(phi3)+10*cos(phi2)-r1 == 0; eqn2 = 15*cos...

3 years ago | 1

| accepted

Answered
I should do the same sing, but woth '' \ '' operator.
Extensive answer has been given here: https://de.mathworks.com/matlabcentral/answers/1875297-how-can-i-find-the-coeficients-alp...

3 years ago | 0

Answered
Why I'm I getting results in terms of t for an and bn even though it is an integration with specific limits?
syms t f = [pi+t,pi-t]; flim= [-pi,0,pi]; N = 5; T = flim(end)-flim(1); w0 = 2*pi/T; fs = 0.0; for i = 0:N for k= ...

3 years ago | 0

Answered
Optimization mvncdf and integral problem
There were some errors in the function supplied to compute the MND. Use function values = fy(x,y,z,det_Y_std,inv_Y_std,Y_mean)...

3 years ago | 0

| accepted

Answered
can someone help me to write the code ?
A_100_iteration = cell(51,50,1); Result_100_iteration = cell(51,50,1); B1_100_iteration = cell(51,50,1); B2_100_iteration = c...

3 years ago | 0

| accepted

Answered
Finding x-intercept in a 2d plot shown below, there are multiple loops I want to find all the values of X at Y=0...Please help..
If you have the x-y values as vectors available, you can use this code to determine the x-values where y=0: i = find(y(1:end-1)...

3 years ago | 1

Answered
Plotting Fourier series in MATLAB (50 partial sums)
n = 1:50; x = (-2*pi:0.01:2*pi).'; f = 1/8 + sum(((-1).^n - 1).*2./(pi^2.*n.^2).*cos(n.*x) + (-1).^(n+1)./(4*pi*n).*sin(n.*x),...

3 years ago | 0

Answered
Why is my code not working?
Run [fList, pList] = matlab.codetools.requiredFilesAndProducts('untitled8.m') pList.Name pList.Version pList.ProductNumber ...

3 years ago | 0

Answered
Assembling Global Stiffness Matrix
This is analogous to your 2x2 code. I don't know if it's the right way to code M. k1=rand(4); k2=rand(4); k3=rand(4); C = ...

3 years ago | 0

Answered
question regarding sum(m,3) command
It is summed over the third dimension of the matrix. A = zeros(2,2,2); A(:,:,1) = [1 2;3 4]; A(:,:,2) = [5 6;7 8]; sum(A,3) ...

3 years ago | 0

| accepted

Answered
Optimize a variable which is dependent on other variables
theta = 1:20; l = 5; obj = @(x) x(1); x0 = rand(1,numel(theta)+1); sol = fmincon(obj,x0,[],[],[],[],zeros(1,numel(theta)+1),...

3 years ago | 1

| accepted

Answered
Getting multiple outputs in one time
A = arrayfun(@(k)stiff(k),1:20,'UniformOutput',0) function out = stiff(k) out = k*[1 2 3;4 5 6]; end

3 years ago | 0

Load more