Answered
OR gives invalid results
if left == 1 || left == 3 ... The condition "3" is empty and thus true. MATLAB does not relate the "3" to "left".

4 years ago | 0

| accepted

Answered
matrix elements must be finite
I get the error message that chol cannot be used since the input matrix is not positive definite. Analyze Pxx - maybe it has Na...

4 years ago | 0

| accepted

Answered
Polynomial surface fitting problem with constraint y <=1
If N is the number of (y12,x1,x2) data, use fmincon instead of lsqcurvefit and set the constraints a*x1_i^b + c*x2_i^d - 1 <= 0...

4 years ago | 1

Answered
Simultaneously solve over-defined system of 35 equations, with only 2 unknowns
Put the coefficients in a (35x2) matrix A and the numbers of the right-hand side in a (35x1) vector b. Then you can solve for C...

4 years ago | 1

Answered
How to obtain a histogram for 3d data?
Since your curves are all 1d, a 1d- histogram suffices if you identify x-axis coordinate with curve length or parametrized point...

4 years ago | 0

Answered
Is it possible to do a search in a table for a value nearest to a number I want?
array = [1 3; 2 4; 5 4; 7 10; 9 3; 100 12; 44 22; 65 11; ...

4 years ago | 0

Answered
solve Nonlinear PDE and compare the analytical and numerical solutions
D = 3e-3; xstart = 0.0; xend = 1.0; dx = 1/400; tstart = 0.0; tend = 0.5; dt = 0.01; X = (xstart:dx:xend).'; T = ...

4 years ago | 0

Answered
Check for incorrect argument data type or missing argument in call to function 'matlabFunction'.
If i and p(1,i) and p(2,i) are defined, you should use p(1,i) = 3.0; p(2,i) = 15.0; g = @(val)(p(1,i)-val(1)).^2+(p(2,i)-val(...

4 years ago | 0

Answered
Minimum and Maximum value of fitted curve
p = polyfit(x,y,4); dp=polyder(p); ddp=polyder(dp); r=roots(dp); r=r(abs(imag(r) ) < 1e-6); maxima=r(polyval(ddp,r))<=1e-6 ...

4 years ago | 1

Answered
how to get common range for several intervals
Maybe not the most elegant solution, but it should work: Data=[26 27 22 23.3 22.5 23.4 22 23 20 23.7 2...

4 years ago | 0

| accepted

Answered
Unable to solve this coupled boundary value differential Equation
bvp4c is the appropriate tool to set up this problem. For this, rewrite your equations as dy(1) = y(2) dy(2) = y(3) dy(3) = ...

4 years ago | 0

Answered
I would like to ask how to perform nonlinear fitting with two fixed endpoints. Thank you very much for your answer.
If your fitting function depends on n parameters to be fitted, the condition that the function passes through 2 fixed points mak...

4 years ago | 0

| accepted

Answered
How to numerically solve and plot after solving the integration with a constant Multiplication
B = 51; C = 10; S0 = ...; lam_d = ...; H1 = (1/pi)*(S0./lam_d).^2; K= @(t) (sin(t)-t.*cos(t)).^(1/2).*(sin(t)+ 51*sin(10*t)...

4 years ago | 1

Answered
solve Nonlinear PDE and compare the analytical and numerical solutions
In the recursion % Implementation of the Crank-Nicholson method for j = 1:Nt u(2:Nx,j+1) = inv(MM...

4 years ago | 1

| accepted

Answered
How can I solve the italicized equation for the matrix gamma_e, gamma_s and d1 ?
syms x y d dvals = 0.9:-0.1:0.1; num_d = length(dvals); EU_e = zeros(num_d,1); EU_s = zeros(num_d,1); xvalue1 = zeros(num_d...

4 years ago | 0

| accepted

Answered
The professor asked to remake the C++ code in MATLAB.
Don't know if this is what you want: nnucl = 1; nH = 10.^-7; nH2 = 10.^-3; nHp = 10.^-2; nOI = 10.^-8; ne = 10.^-2; kb ...

4 years ago | 0

Answered
Creating a fourbar mechanism with certain constraints
You can just delete this line because the FP in your call to "fmincon" is only a formal parameter.

4 years ago | 0

Answered
Replacing a row of the matrix as a function?
temp = [1 2 3; 4 5 6; 7 8 9]; fun = @(x)[x, 2*x, 3*x]; temp = @(x)[temp(1,:);fun(x);temp(3,:)]; temp(4)

4 years ago | 0

Answered
plotting graph using symbolic equation
From what you wrote, there is no relation between f and Avh. Can you write down Avh as a function of f so that - given numerica...

4 years ago | 0

Answered
who does logical works
The even elements of the x-vector are multiplied by a factor of 5, the odd elements remain unchanged.

4 years ago | 0

Answered
How to plot PDF of X if X= rand and PDF of X if X= rand-0.3. Do I have to use pdf function for this?
If you don't know by looking at the formulae for X what the respective PDF is, use a Monte-Carlo simulation: X = rand(10000,1);...

4 years ago | 0

Answered
I want to plot a function that is defined implicitly as a bound of integration of an integral equation.
p = 10; N = 3; m = 2; f = @(x) 1/sqrt(2*(N-2))*1./sqrt(p/N*(x.^(-N)-1)-1/(N-m)*(x.^(-N)-x.^(-m))); T = 0:0.01:0.3; r0 = 0.5...

4 years ago | 0

| accepted

Answered
Index exceeds the number of array elements (11819)
Error message seems clear to me: The arrays slip_angle_front_outer slip_angle_front_inner slip_angle_rear_outer slip_angle_...

4 years ago | 0

Answered
I need a function which returns 0 if the argument is negative
g = @(x) (x > 0).*f(x)

4 years ago | 0

Answered
calculating size of column with specified value in the column
DDDx = zeros(50,1); for i = 1:50 DDDx(i) = numel(e1(e1(:,2)==i)); end

4 years ago | 1

Answered
Symbolic differentiation for very long equation
Here is a code to test MATLAB's answer: syms ua us g R rho D = 1 / sym('3') / (ua + (1-g) * us); z0 = 1 / (ua + (1 - g) * u...

4 years ago | 0

| accepted

Answered
File: bvpfcn.m Line: 1 Column: 23 Invalid use of operator.
In principle, this is a direct copy of the first example for bvp4c in the MATLAB documentation. You only had to give different ...

4 years ago | 0

Answered
Newton Raphson Liquid-liquid extraction
No sum constraint on sum_i xi ? n = 8; x1space = linspace(0,1,n); xresp = zeros(1,n); Tresp = zeros(1,n); %for i = 1:n i...

4 years ago | 0

Answered
Trying to use ode45 to solve a second order differential equation with time dependent parameters
Results as expected ? %This is the ODE45 code. function project_anglefunction close all clc % using ODE45 to solve fo...

4 years ago | 0

Answered
Symbolic Paramaters Not Supported in Nonpolynomial Equations
Use an ODE integrator (e.g. ODE45) to solve dU/dt = -Fd(t)/m_sat * v_inf/U - g*sqrt(1-(v_inf/U)^2) - q(t)*W (1') dW...

4 years ago | 0

Load more