Answered
how to interpolate?
Bi=0:0.001:14.5; Ai=interp1(B,A,Bi)

7 years ago | 0

| accepted

Answered
what is the mistake in the code of first order, second order and fourth order errors of first order derivative of function sinx/x^3 in which the first order error graph is significantly lower than second and fourth order errors.
central_differencing=((sin(x+dx)/(x+dx)^3)-(sin(x-dx)/(x-dx)^3))/(2*dx); numerical_derivative=(((sin(x-2*dx))/((x-2*dx)^3...

7 years ago | 1

| accepted

Answered
Using ODE45 to solve 2 dependent variable : dQ (solar radiation at specific time of the day(hour)) and dT/dt (temperature change of a particle ) of a particle during solar drying
function main T0 = 373.15; %Initial temperature in Kelvin tspan = [1 12]; %hours dt = 0.1; Time2 = (1:...

7 years ago | 0

Answered
Numerical solution of a trigonometric equation
function main a = fun(0.1,0.1) end function a = fun(x,k) t = x*cos(k); if abs(t) <= 1 sol(1) =...

7 years ago | 2

| accepted

Answered
How can I solve optimization polynomial problem?
This is a linear problem in x. The solution is readily given by xdata = [0;0.25;0.5;0.75;1]; ydata = rand(5,1); ...

7 years ago | 0

Answered
How to plot Fourier series for function in a right way?
f=@(x)-2/pi*x.*(x>=0 & x<=pi/2)-2*(x/pi+1).*(x>=-pi & x<=-pi/2); n=50; k=0:n; a=1/pi*(integral(@(x)f(x).*cos(k*x),-pi...

7 years ago | 0

| accepted

Answered
Please Help Me! i want to plot a equation dx/dt = y-5; dy/dt = -x+5; x(0)=0,y(0)=0. What type of code solver should i use.
Use "dsolve" for solving and "fplot" for plotting. Best wishes Torsten.

7 years ago | 1

Answered
LINPROG requires the following inputs to be of data type double: 'LB'. Any help is greatly appreciated.
c(i) = linprog(-r,[1;dot(ones(1,i),c(1:i))],[C(i);rho*I*J],[],[],[],[],options);

7 years ago | 0

Answered
How can I plug complex numbers in function ?
theta=0:0.0001:2*pi; r=0.5; x=2+r*cos(theta); y=r*sin(theta); s=complex(x,y); g=(s-1)./((s.^3)+4*(s.^2)+7*s+6);...

7 years ago | 0

| accepted

Answered
How do i find the product of all the numbers in my matrix
sol = prod(1:20)

7 years ago | 0

Answered
Non linear equation - fzero identifies too many zero crossings
function main Dm = 1e-10; % Mass diffusion coefficient [m^2/s] K = 3000; % Material to...

7 years ago | 2

| accepted

Answered
Nested While and For Loop
Eqn2 = @(x)zeros(size(x));

7 years ago | 1

| accepted

Answered
I would like to find all roots of a nonlinear equation in one variable, e.g., f(x) = 0.
- Select number of subintervals N of [0:2*pi) - Set x(i)=2*pi*(i-1)/N (i=1,...,N+1) - Evaluate f(x) Begin Loop from ...

7 years ago | 0

Answered
System of equations with sparse linear equations
B is the unknown vector, A and X are given ? Note that B can be determined by backward substitution: n = 65000; B = z...

7 years ago | 0

Answered
Why does my vector turn into a single number in a FOR loop
x = randi(100,1,50); small = x(x<=50) big = x(x>50)

7 years ago | 2

Answered
How can I solve quadratic minimization problem with many constraints?
Take A = [A_1;A_2;...;A_M]; b = [b_1;b_2;...;b_M]; Best wishes Torsten.

7 years ago | 1

| accepted

Answered
second order ODE diff
syms x(t) eqn=diff(x,t,2)+0.78*diff(x,t)+14*x==0.56*sin(t*147); xsol(t)=dsolve(eqn); vel(t)=diff(xsol,t) acc(t)=di...

7 years ago | 0

| accepted

Answered
Need help for solving an Optimization problem
- Take L, Qt, St as variables to be solved for. - Define upper bounds ub and lower bounds lb to account for 0 ≤ Qt ≤ Qm ...

7 years ago | 0

| accepted

Answered
Different answer using ODE45 and symbolic solve
What make you think the two problem formulations are equivalent ? Symbolically you solve an algebraic equation while numerica...

7 years ago | 0

| accepted

Answered
Unable to solve symbolically.
x0 = [1 2]; fun = @(x)sin(x)-0.703*x; sol = fzero(fun,x0)

7 years ago | 1

| accepted

Answered
Help me to fix it because the error said Attempted to access xnew(2); index out of bounds because numel(xnew)=1. Error in jacobi (line 22) err = norm(xnew(i)-x(i),Inf)/norm(xnew(i),Inf);
In the line xnew = -(1/a(i,i)) * (sum - b(i)); you reset xnew from a (3x1) vector to a scalar. That's the reason why for...

7 years ago | 0

Answered
How to add parameters to fmincon?
[xopt,funval] = fmincon(@(x) fun(x(1),x(2),a,b),x0,[],[],[],[],lb,rb);

7 years ago | 0

| accepted

Answered
is there a matlab code for gaussion integration!!!
Google "Gaussian Integration & matlab"

7 years ago | 0

Answered
How to find the approximation of the solution to an equation with an infinite series?
function main c = ...; M0 = ...; R = ...; delta = ...; N = ...; x0 = ...; sol = fzero(@(x)f...

7 years ago | 0

Answered
Objective function in a for loop
No, because the number of elements of ((0.0011*(x(i):1*N)-x((i-1):N-1))) must always be N-1.

7 years ago | 0

Answered
How can I fit a function using fmincon?
I don't understand your LL-function: 1/1+params(1) ? Shouldn't the "error" array enter LL somewhere ? Further, you will...

7 years ago | 0

| accepted

Answered
HOW TO SOLVE THIS INTEGRATION?
P = 2.0; h = 1.0; T = 3.0; k = 0.01; fun = @(y)sqrt(P*(h-y)+T*exp(-k*y)); ylow = 0.0; yhigh = 1.0; sol = ...

7 years ago | 0

| accepted

Answered
Can I find constants in a system of differential equations?
function main tData = [...]; % your array of measurement times dDdtdata = [...]; % your array of measurements for dD/dt...

7 years ago | 0

| accepted

Answered
Calculate residuals as a single number in lsqnonlin function
If you use the usual naming conventions of lsqnonlin, the residual is "sum(F.^2)" Best wishes Torsten.

7 years ago | 0

Answered
"setdiff" comand usage ?
https://de.mathworks.com/matlabcentral/answers/406227-excluding-one-vector-from-another-vector-with-repetition

7 years ago | 1

| accepted

Load more