Answered
Calculate Euclidean Distance between one point and many others
Dist = sqrt(X.^2 + Y.^2 + Z.^2)

4 years ago | 1

Answered
Why do I get an infinity number in matrix X2?
function main %A = [2 -1 1; 3 -3 9; 3 3 5]; %b = [7; 18; 14]; %x0 = [1; 0; 0]; A = [4 -1 -1; -2 6 1; -1 1 7]; ...

4 years ago | 0

Answered
Invalid index showing Index exceeds the number of array elements. Index must not exceed 1.
For i=1, the p-loop is empty since your loop index goes from p=1:i-1. Thus for i=1, a(i+1) = a(2), b(i+1) = b(2) and c(i+1) = ...

4 years ago | 0

| accepted

Answered
An error occurred when implementing gradient descent
What can I modify in my code to plot the desired contour and plot the graph in this way Change the line f = -200*(y-x^2)^2+ (1...

4 years ago | 0

| accepted

Answered
Need help to solve nonlinear ode in matlab
Write your equation as u'' = -T/(1-2*R*u'), substitute u1 = u and u2 = u' to arrive at the system u1' = u2 u2' = -T/(1-2*R*u...

4 years ago | 1

Answered
least square fitting of multiple variable equation (error: too many input arguments)
x=lsqcurvefit(@(w)distribution(w(1),w(2)),w0,EXP_x,EXP_y,lb,ub); instead of x=lsqcurvefit(@distribution,w0,EXP_x,EXP_y,lb,ub);...

4 years ago | 1

| accepted

Answered
I want to generate uniform distribution of points on the surface of a sphere
https://de.mathworks.com/matlabcentral/fileexchange/37004-suite-of-functions-to-perform-uniform-sampling-of-a-sphere

4 years ago | 0

Answered
I am trying to get values for my lagrange interpolation. Can someone help me out and explain what im doing wrong here?
x = [1, 2 ,3 , 4, 5, 6] y =[ 1.5, 3,6,11,15,17] h = .1 n = length(x)- 1; points = []; xpVal =[]; for m= 1:n +1 xp = ...

4 years ago | 1

| accepted

Answered
First column matrix into ones
X = [1 4; 2 2; 3 6]; X(:,1) = 1 or y = ones(size(X,1),1) depending on how your question is meant.

4 years ago | 0

| accepted

Answered
Non Dimensionalization Of Self Similar Curves
s = 2:10 f = @(x,a)exp(-((x-60)/a).^2) x = 40:0.01:80; for i = 1:numel(s) fnum(:,i) = f(x,s(i)); end plot(x,fnum) By ...

4 years ago | 2

| accepted

Answered
accessing single function from an array of functions
f = {@(t) t, @(t) exp(t), @exp} % the second and third are equivalent SecondFunction = f{2}; ValueOfSecondFunction = SecondFun...

4 years ago | 0

| accepted

Answered
Can someone help me with this integration
THETA_S = 0:0.1:pi/2; for i = 1:length(THETA_S) theta_s = THETA_S(i); f1 = @(theta_v,phi) ((((1/(2.*pi)).*((pi-phi).*...

4 years ago | 1

| accepted

Answered
Boundary conditions for Catenary (hanging cable), solve for 3 unknown constants (c1 c2 c3)
The equations "fsolve" must solve for c are (1) c(3) + c(2)*cosh((L(1)-c(1))/c(2)) - L(2) = 0 (2) c(3) + c(2)*cosh((R(1)-c(1))...

4 years ago | 1

| accepted

Answered
BVP4C, differential equation for beam deflection
This is the solution for w(0)=w'(0)=0: M = [50 40 30 20 10 0]; I = [1 1 1 2 2 2]; E = [190e9 190e9 100e9 100e9 100e9 100e9]; ...

4 years ago | 0

Answered
I have a path of a vehicle going in concentric circles. There is some deviation in the circles due to various errors. How do I get an average circular path?
Use" lsqnonlin" to fit your (x,y) data to the equation (x-xc).^2+(y-yc).^2-r^2 = 0. The parameters "lsqnonlin" will determine a...

4 years ago | 0

Answered
Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.
Nx=50; Ny=50; Mx=20e-9; My=20e-9; x=linspace(-Mx/2,Mx/2,Nx); y=linspace(-My/2,My/2,Ny); Vb1=...

4 years ago | 0

Answered
Computing the jacobian of an anonymous function - MATLAB
Why not simply using "fsolve" to calculate steady state ? For "fsolve" to work, you only have to supply the function ModelRHS -...

4 years ago | 1

Answered
Why is the error appearing? How to solve it? "Error using optimfcnchk If FUN is a MATLAB object, it must have a feval method"
function main % Limits LB = [0.0485 0.0365 0 0 0]; UB = [0.055 0.039 24 0.7 2.5]; % Optimization parameters X0 = [0.05 0....

4 years ago | 0

| accepted

Answered
Issue with 4 equations with 4 unknowns
syms a b c d equation1=2*(c*a-c)==(-.650034*a); equation2=2*(c*b+(1.95*d))==.0271656*b; equation3=(.6*d)+(3.3*b)==1; equatio...

4 years ago | 0

| accepted

Answered
Solving a system of 2 ODEs with Implicit Euler Method? Please Help!
As you can see from the plot obtained from ODE15S, there are discontinuities in the solution of the ODE. I don't think you will...

4 years ago | 0

Answered
I am trying to find the roots of this equation but my code doesn't work. It keeps saying theta0 is unrecognized,
function main theta0 = 0; theta = fzero(@f,theta0) end function res = f(theta) y0 = 2; yf = 1; v0 = 20; x =...

4 years ago | 0

Answered
optimization for min and max values of a parameter
function main Angmin = -30*pi/180; Angmax = 30*pi/180; A =[]; b = []; Aeq =[]; beq= []; lb = [-Inf -Inf -I...

4 years ago | 0

Answered
Converting symbolic matrix to numeric matrix with while loop
First solve the equations for all variables involved being scalars: syms N1 N2 N3 N4 N5 N6 a2sym a3sym a4sym a5sym a6sym S1sym ...

4 years ago | 0

| accepted

Answered
estimate the relative sensitivity coefficients
% TODO - Write the function declaration. Name the function SIRmodel tRange = [0 100]; % Initial condition Y0 = [0;0]; % Para...

4 years ago | 0

Answered
Matlab doesn't run
n = -5:0.01:5; x21 = exp(-abs(n)); X_21= @(w) sum(x21.*exp(-j*w*n),2); w = linspace(-2*pi,2*pi,100).'; plot(w,abs(X_21(w)));...

4 years ago | 0

Answered
Root LP problem is unbounded.
Yes, I can see it with my naked eye that you can make the objective function as big as you like. Take x(1) = 1e100, x(2) = 1e10...

4 years ago | 2

| accepted

Answered
Different error calculation between Finite Element Method's numerical solution and exact solution
xvec = linspace(0,pi,9); f1 = @(x)(interp1(xvec,usol,x,'linear') - sin(x)).^2; l2_error = sqrt(integral(f1,0,pi)) for the L2-...

4 years ago | 0

Answered
Generate Lognormal distribuition with normrnd
If X is normal distributed with parameters mu=0 and sigma, then Y = 10^(X/10) = exp(X*log(10)/10) = exp(X/sigma * sigma*log(10...

4 years ago | 0

| accepted

Load more