Answered
how to write a function that contains integration
E=...; rho=@(E_s) ...; fun=@(E,E_s)rho(E_s)/(delta*sqrt(2*pi)).*exp(-(E-E_s).^2/(2*delta^2)); values=integral(@(E_s)f...

10 years ago | 0

Answered
I need to implement the following formula in my code but getting an error as "First input argument must be a function handle."How do i proceed? a nd v has been defined in prior
For discrete data, use trapz instead of integral: P=[0,0.1*1E8,0.2*1E8,0.3*1E8,0.4*1E8,0.5*1E8,0.6*1E8,0.7*1E8,0.8*1E8,0.9*...

10 years ago | 0

Answered
Replace one value in a 2 variable's function
g=@(x)f(x,a) Then work with g. Best wishes Torsten.

10 years ago | 0

Answered
How do I use dsolve() to solve a second order ODE with variable coefficients?
http://www.wolframalpha.com/input/?i=(1%2Bt)*y''(t)+%2B+y'(t)+%3D+5*(Sin%5B2*pi*t%5D)%5E2 Best wishes Torsten.

10 years ago | 0

Answered
fzero of two functions subtracted
fzero(fun,1); Best wishes Torsten.

10 years ago | 0

| accepted

Answered
how to minimize distance with optimization
The problem as stated does not have a solution since it is unbounded. Choose x1=(M-9)/4, x2=(M+3)/4 and y=(13-M)/4 ...

10 years ago | 0

Answered
Iterative solution for 6x6 system
My guess is that you want to insert F34(i)=f34 before the "end" of the loop over i: ... if f34prime==0 ...

10 years ago | 0

Answered
How can I obtain the inverse of a 3d matrix
b1=k(:,:,1); b1inv=inv(b1); does not work ? Best wishes Torsten.

10 years ago | 1

Answered
Roots of a function
Try this: function driver y=zeros(1,2); y(1)=0; y(2)=1; x0=zeros(1,2); x=fsolve(@(x)HW1(x,y),x0) func...

10 years ago | 0

| accepted

Answered
Soving a system of two ordinary differential equations, in two different variable
For a start, the following code might help: function driver nx = 101; tstart = 0; tend = 100; y=zeros(1,nx); ...

10 years ago | 0

Answered
How to fix gradient descent code?
I don't know why you use such a complicated approach. Just execute data = load('data.txt' ); A = [ones(length(data(:,...

10 years ago | 0

Answered
Numerical integration with a singularity at the upper limit
Your integral only exists for n < 3/2 (if the lower x-limit is greater 0). Best wishes Torsten.

10 years ago | 0

Answered
How to fix gradient descent code?
theta(1) - alpha * (1/m) * h * X(:, 1) and theta(2) - alpha * (1/m) * h * X(:, 2) are 2x1 vectors which are assig...

10 years ago | 0

| accepted

Answered
Using ode45 to solve a system of second order differential equations.
The second and third example under http://de.mathworks.com/help/matlab/ref/ode45.html are second-order equations solved wi...

10 years ago | 0

Answered
Initial condition of y(0) = 1
Just put it y(1) = 1.0; The '0' does not refer to the spatial x-value, but is an array index. Keep in mind that x(1)=0, a...

10 years ago | 0

| accepted

Answered
How can I reduce the time for this Gaussian Elimination Code
n=4*146; S=sparse(gallery('tridiag',n,-1,2,-1)); b=sparse(1;zeros(n-2,1);1); x=S\b; should do the same as your pro...

10 years ago | 1

Answered
How could find multiples of a given number N ?
"input" is a multiple of N if and only if mod(input,N)=0. Best wishes Torsten.

10 years ago | 3

| accepted

Answered
Use of optimset to change maxfun evals
Use [k,fval] = fminsearch(@(k)err(k,sec_1,sec_2,sec_3,sec_4,sec_5,sec_9,Cexp1,Cexp2,Cexp3,Cexp4,Cexp5,Cexp9),k0,options); ...

10 years ago | 1

| accepted

Answered
Bessel function of the first kind
For an explanation, google "Bessel's maze" and take the first hit. Best wishes Torsten.

10 years ago | 2

Answered
change the stop mode of fminunc
Use the OutputFcn option in the option structure for fminunc, calculate your expression in the corresponding output function and...

10 years ago | 1

Answered
How can I find y for a specific value of x?
x0=...; fun=@(y)f(x0,y); y0=fzero(fun,1) Best wishes Torsten.

10 years ago | 0

| accepted

Answered
How can I find a solution for this non-linear, stiff 2nd order ODE?
odefun = @(x,y) [ y(2); b/a*y(1)^4 - c/a ]; Best wishes Torsten.

10 years ago | 1

| accepted

Answered
How do I solve an equation using two 1D matrices of different sizes and ranges as inputs?
y=[1 2 3]; z=[1 2 3]; x=y'*z; Best wishes Torsten.

10 years ago | 0

Answered
I have an polynomial f(x) = 4x^5 + 5x^4 + 2x^3 +2x^2 +3x. And x ranges from {0 to 63}. How do I code this so I can display answer corresponding to every value of x.?
p=[4 5 2 2 3 0]; x0=1; polyval(p,x0); evaluates your polynomial at x0=1. Best wishes Torsten.

10 years ago | 0

| accepted

Answered
Solving shooting method with ode45
There are so many errors in your code that you should start simple. Your problem is not a standard boundary value problem. ...

10 years ago | 0

Answered
How to solve symbolic system of non linear equation
[solt1,solt2,solt3]=solve(eq1,eq2,eq3,t2,t3,t4); Best wishes Torsten.

10 years ago | 1

Answered
Solving a non linear set of pdes with multiple dependent variables.
There is no ready-to-use MATLAB tool available to solve the equations you posted. The problem is that you have a system of ordi...

10 years ago | 0

Answered
solving 3 order ode
Solution is y identically 0. Best wishes Torsten.

10 years ago | 0

Answered
need help in solving 2nd order ODE using finite difference method: central scheme
What are your boundary conditions ? Best wishes Torsten.

10 years ago | 0

| accepted

Answered
Script error ode23
You can't call ODE23 as [t,x] = ode23('DOF2LDE',0,tf,[0 0]',tol); The second argument in the call has to be a vector of ...

10 years ago | 0

Load more