Answered
Finding root of nonlinear functions
f = @(y)(y-0.8193318913*tanh(y)).*(0.7500000000e-3*y.^2-0.1622336517e-1)+0.2931044702e-2*tanh(y); fun = @(y)f(y)./(0.7500000000...

4 years ago | 2

| accepted

Answered
Constrained linear least-squares problems, with unknowns in multiplier matrix
You must use a nonlinear optimizer (in this case: fmincon) because products of the parameters to be estimated are involved (b*V,...

4 years ago | 0

| accepted

Answered
Mulitpling diffrent scalars to diffrent numbers in a matrix
Check your resulting vector. According to your rules, it is wrong. v = [1 6 3 17 30 7 10 4 25 27]; s = 17*ones(1,numel(v)); s...

4 years ago | 0

Answered
Integration of a vector inside function for ode45
In the code below, x(3) = integral_{tau=0}^{tau=t} -0.01*x(1) dtau t=0:0.01:10; in=pi/2; indxdt=0; [t,x]= ode45(@(t,x) slmc(...

4 years ago | 0

| accepted

Answered
Gradient Descent Implementation on a function, as opposed to an equation
Use fun = @(x)ErrorFunction(x(1),x(2),x(3),x(4),x(5),x(6)) as the function handle you work on in the steepest decent.

4 years ago | 0

Answered
How to not use for loop
function dfdx = ddx(f, h) dfdx = gradient(f,h); end

4 years ago | 1

Answered
Surface data cloud fitting to even asphere model
% your data x = ...; y = ...; z = ...; p0 = [...]; % initial guess for R and kappa p = lsqnonlin(@(p)fun(p,x,y,z),p0) ...

4 years ago | 0

| accepted

Answered
my limits wont work
syms x lim1= [nthroot(x^6+8,3)/4*x^2+nthroot(3*x^4+1,2)] limit(lim1,x, Inf)

4 years ago | 0

Answered
Output is giving me Empty sym: 0-by-1
f=1995.26; z=71440; seta=-77.04; syms c R; eqns = [ tand(seta) + 1 / ( 2 * pi * f * c * R ) == 0, z^2 - 1 / (R^2 + ( 2 * pi...

4 years ago | 0

| accepted

Answered
What is the best function of the following shape?
x = -2:0.01:2; plot([x,x(end)],[1/pi*atan(2*x)+1/2,1/pi*atan(2*x(1))+1/2]) xlim ([-3 3]) ylim ([0 1])

4 years ago | 2

Answered
Plotting a function that performs a sum.
f = @(x,y,z) sum(sin((3:15).*sqrt(x*y))+z); x = linspace(0,1,100); y = 0.5; z = 0.1; plot(x,arrayfun(@(x)f(x,y,z),x)) But i...

4 years ago | 1

| accepted

Answered
symbolic function of a symbolic vector variable
y = [-1, 2, -1]; syms f(z) z = sym('z',[1 3]); f(z) = y + z f(1,2,3)

4 years ago | 0

Answered
How to constrain the resulting equation from a polynomial surface fit to a positive range?
Use "lsqlin" and put the constraints p33(x(i),y(j)) >= 0 for all (i,j)-combinations. These constraints can be put as A*coeffs...

4 years ago | 0

Answered
4 Nonlinear equations solve for 4 variables
%Initial guesses E1o = 0.00009; E2o = 0.00009; E3o = 0.0009; Noio = 0.1; X0 = [E1o; E2o; E3o; Noio]; %call fsolve fu...

4 years ago | 0

Answered
Estimate for Residual variance function calculation
x = normrnd(10, 1, 1, 100); y = 1 + 2 .* x + normrnd(0, 1, 1, 100); n = 100; xBar = mean(x); yBar = mean(y); %slope sxy = ...

4 years ago | 0

Answered
How to solve "Rank deficient, rank = 7, tol = 6.169247e+09." in nlinfit
There must be something that you misunderstood in the article. The problem from above is a linear fitting problem for the vecto...

4 years ago | 0

| accepted

Answered
There are 500 different sizes of a bolt ranging around 0.5 mm. I want to separate the sizes that are above or below the tolerance. then add those results in a column vector
boltMeasurements = 0.5+0.005*randn(500,1); n = length(boltMeasurements) %number of values in array which is n=500 different ...

4 years ago | 1

| accepted

Answered
help on solving system of differential equations
Your code gives f = y and g = z with the z in the solution for g as a free parameter. It has nothing to do with your function z(...

4 years ago | 1

| accepted

Answered
Issue with finding the indices of the minimum element in a 3-Dimensional Array
A = rand(10,10,11); B = A(:); index = find(A==min(B)) B(index) [i j k] = ind2sub([10 10 11],index) A(i,j,k)

4 years ago | 0

| accepted

Answered
Solving overdetermined linear sytem for possible solutions
Choose RI as a binary integer vector (0 or 1) of length N. Constraint is sum(RI) = K and sum(RI.'*A) = B. Of course, this is on...

4 years ago | 0

Answered
I need to make a Gaussian fit, problem is i dont know how to type the parameters using lsqcurvefit
M = [ 24.6 1.518572825 24.7 1.5083088954 24.8 1.5210166178 24.9 1.4203323558 24...

4 years ago | 1

| accepted

Answered
Index in position 1 exceeds array bounds.
Seems that with the command if k == numfilesperday data(1:4,:) = []; end you have destroyed the complete matrix "data"....

4 years ago | 1

Answered
Matrix inside for loop not updating
hold on for t =1:1:200 g1(t)=3*cos(2*pi*450*t-141); plot(t,g1(t),'.') drawnow end

4 years ago | 0

| accepted

Answered
Failing in creating a surface from three array
To create a surface, you need a z value for each combination of (x/y) values. Thus instead of a vector z with 6 elements you nee...

4 years ago | 1

Answered
Please explain how to solve coupled equation in MATLAB? ODE 45 or Runge kutta method? The equation is d/dz(Ep) + (n/c) d/dt (Ep) = Es M where n= 1.45 and C = 3e8
The equation you posted is a PDE, not an ODE. So an ODE integrator cannot be used directly for its solution. You will have to d...

4 years ago | 0

Answered
Intersection of two parametric circles in R3
Minimize(t1,t2) norm(v1(t1)-v2(t2))^2 Use an optimizer to determine t1 and t2, e.g. fminsearch.

4 years ago | 0

Answered
Using a fucntion in loop
P = [1 -2 4] a = 0; n = 3; while(a < n) P = polyder(P) a = a + 1; end

4 years ago | 0

| accepted

Answered
increasing amplitude of sine wave
y=t/StopTime.*sin(2*pi*Fc*t); instead of y = A*sin(2*pi*Fc*t);

4 years ago | 0

Load more