Answered
Integration within particular range
idx = x>=2 && x<=3; xp = x(idx); yp = y(idx); value = trapz(xp,yp)

7 years ago | 0

| accepted

Answered
Solve symbolic Sylvester-like equation
syms a x11 x12 x21 x22 b11 b12 b21 b22 A=[a+sym('1'), sym('2'); sym('3'),sym('1')]; X=[x11,x12;x21,x22]; B=[b11,b12;b21,b22];...

7 years ago | 0

Answered
speed for loop in sum
function main x = linspace(-2,2,100); %some vector [X,XX] = meshgrid(x,x); %some matrix k = 0:20; a = 0.5; A0 = a...

7 years ago | 1

| accepted

Answered
How to use lognrnd?
It is common to say that X is lognormally distributed with parameters mu and sigma if it has the pdf f(x) = 1/(x*sigma*sqrt(2*p...

7 years ago | 0

| accepted

Answered
Numerical value for sum of bessel functions
k = 0:10; x = 3; A0 = sum((-1).^k.*x.^(2*k).*besselj(2*k,x)) If x is a vector, use A0 = arrayfun(@(x)sum((-1).^k.*x.^(2*k)....

7 years ago | 1

| accepted

Answered
System of differential equations and fitting with lsqcurvefit
function main % loading Exp data CurrentDensity = xlsread('Modified_Current_density_all','Sheet1','A1:J1001'); Brightne...

7 years ago | 0

Answered
HOW TO SOLVE TRANSCENDENTAL EQUATION
function main Enle0 = 1.0; Enle = fzero(@fun,Enle0) end function res = fun(Enle) Vc = 0.249; c = 3e8; m0 = 0....

7 years ago | 1

| accepted

Answered
Finding the 'n'-th derivative of a function containing 'n'
syms x k n = 10; diff(exp(-x)*x^(n+k),x,n)

7 years ago | 0

| accepted

Answered
how to create an vector contains 10000 random values that uniformly distributed with mean 1 and variance 10 ?
mean = 1.0; std = sqrt(10); N = 10000; u = (mean-sqrt(12)/2*std) + sqrt(12)*std*rand(N,1) u is uniformly distributed on [a:...

7 years ago | 0

| accepted

Answered
How to run lsqcurvefit with a function handle with 2 array-variables?
rao_H2O = @(k,x) k(1)*k(2)*C_TBA_H2O./(1+k(2)*C_TBA_H2O+(k(2)*C_H2O).^gamma(2))+k(3)*C_TBA_H2O; xdata = zeros(size(rao_norm)); ...

7 years ago | 0

Answered
Can't figure out how to iterate a variable defined in ode45 function.
[time,s] = ode45(@(time,s)dampedspring(time,s,b),tspan,BC);

7 years ago | 0

Answered
A(B)=0 What is its meaning?
All numbers in the matrix A that are bigger than 0.8 are set to 0.

7 years ago | 0

Answered
FALLING FACTORIAL AND POCHHAMMER
prod(x-a+1:x)

7 years ago | 0

| accepted

Answered
How to sum all positive values in each row in matrix?
sum(max(A,0),2)

7 years ago | 0

| accepted

Answered
Lotto code,the previous number cannot appear again,how do i improve it?
x = rand(1,10); [a b] = sort(x); previous_number = b(1:6) set_for_last_number = setdiff(1:8,previous_number); pos = randi(le...

7 years ago | 0

| accepted

Answered
How to find minima from a fitted 3rd order polynomial
Solve y'(x)=0 for x and check whether f''(x) > 0.

7 years ago | 0

Answered
trying to put this integrative function in Matlab, but i dont know how.
alpha = ...; m0 = ...; h1 = ...; h2 = ...; xs = ...: fun = @(x)exp(-h1*abs(alpha)-h2*sqrt(alpha^2+m0^2))*exp(1i*alpha*(x-xs...

7 years ago | 0

| accepted

Answered
Fix the maximum number of iterations while using ode solvers
https://de.mathworks.com/matlabcentral/answers/94739-is-it-possible-to-specify-the-maximum-amount-of-time-or-number-of-function-...

7 years ago | 0

| accepted

Answered
MATLAB solving BVP using bvp4c, variable coefficient
If you make the ansatz f ( r ) = a0 + a1*r + a2*r^2 + ...+ an *r^n you will need (n+1) additional boundary conditions to fix ...

7 years ago | 0

Answered
Error in using * in Non-linear regression
Elementwise multiplication is required: modelfun = @(b,x) b(1)*(x(:,1).^b(2)).*(x(:,2).^b(3)).*(x(:,3).^b(4));

7 years ago | 0

| accepted

Answered
IMPOSING CONSTRAINTS in FMINCON
A=[0 1 1 0; 0 1 -1 0]; b=[1;0];

7 years ago | 0

| accepted

Answered
BVP PROBLEM how can we take 'c' in x-axis(continuous range.[-1.3:0.02:-1.1]) and to find f"(0)
function main S = 1; c = [-1.3:0.02:-1.1]; Pr = 0.7; n = -0.8; sol = zeros(numel(c),1); x = [3 -1]; ...

7 years ago | 0

| accepted

Answered
problem solving nonlinear equation system with fsolve
Try Maugis = @(X) [lambda*X(1)^2/2*(sqrt(X(3)^2-1)+(X(3)^2-2)*atan(sqrt(X(3)^2-1)))+4/3*lambda^2*X(1)*(sqrt(X(3)^2-1)*atan(sqrt...

7 years ago | 0

| accepted

Answered
Why does my rand function not seem to work?
You will never hit 0.3266 exactly using the "rand" command. You can use if abs(tmp-limit) < 1e-6 or something similar in you...

7 years ago | 1

| accepted

Answered
How to calculate an integral with an infinite series inside?
I get I = sum_{n=1}^{n=Inf} (1-exp(-4*n^2*t))/(4*n^2) I don't know if an analytical solution exists. Best wishes Torsten.

7 years ago | 0

Answered
How can I integrate a function which was generated by a smoothing spline?
int(i,1)=integral(@(x)feval(f,x),1.2,1.6);

7 years ago | 1

| accepted

Answered
Runge- kutta Help on solving end order Differential equation
function RungeKuttaMethod a = 0; %time interval we are solving over b = 4; N = 1000; %...

7 years ago | 1

Answered
2nd Order Nonlinear Differential Equation Solving with Central Difference Method?
http://web.mit.edu/10.001/Web/Course_Notes/Differential_Equations_Notes/node9.html

7 years ago | 1

Answered
Nonlinear 2nd order ODE with term x^2*y'' and initial value y(0)=20
https://en.wikipedia.org/wiki/Cauchy%E2%80%93Euler_equation The section Second order – solution through change of variables s...

7 years ago | 0

Answered
Numerically solve of integral equation with known Integrand
If d2z_p(i) = dv_p / dtau at tau = i * t / n = i * dt and d2z_f(i) = dv_f / dtau at tau = i * t / n = i * dt in your code from a...

7 years ago | 1

| accepted

Load more