Answered
Error in ode45
[t,n] = ode45(@(t,n)ODE(t,n,k1,k2,...),[0 1e-3],IC); Better to write an array for k with 155 entries (k(1),k(2),...) than to d...

5 years ago | 1

| accepted

Answered
ODE 45 to solve coupled ODE
To be honest, I'd prefer to know what Matlab solves. Order the variables as [z1,z2,z3,z4,z5,z6] = [y1,y2,y3,y1',y2',y3'] Then...

5 years ago | 0

Answered
NUMERICAL METHODS DISCRETISATION PROBLEM
Solve -Δv = -5/4*π^2*sin(π*x)*cos(π*y/2) by just modifying the b-vector from exercise part a). Let the solution be v. Then a...

5 years ago | 0

Answered
How to set up a function
Differentiating your equation with respect to t gives the differential equation V'(t) = Qdot/(m*R_s*T) * V(t) with solution V...

5 years ago | 0

Answered
Using the improved Euler (Huen) method, determine the approximate solution y (t) of the following starting problem:
Untested ! function main H = [1/2 ,1/4,1/8,1/16,1/32]; t0 = 0; t1 = 0.5; y0 = 1; f = @(t,y) y*exp(5*t); for i= 1:numel(...

5 years ago | 0

Answered
How to use ode45 in this case?
ydot = y'(t0) + cumtrapz(t,-tan(phi).*(zdd+gravity)); y = y(t0) + cumtrapz(t,ydot), plot(t,y) where t is your (1xn) vector of...

5 years ago | 1

| accepted

Answered
Objective function with summation
Choose u_0,...,u_N as unknowns. In the objective function, calculate x_1,...x_(N+1) from A and u_0,...u_N. Return u_0^2 + ... ...

5 years ago | 0

| accepted

Answered
System of 2nd order ODE with Euler.
y0 must be a 4x1 vector, not a scalar. ye = zeros(4,n) instead of ye=zeros(1,n) ye(:,1) = y0 instead of ye(1) = y0 ye(:,i+1) ...

5 years ago | 1

Answered
lsqcurvefit to estimate parameters in ODE15s
function C = kinetics(theta,t) instead of function [C,T] = kinetics(theta,t) Define stronger RelTol and AbsTol for ODE15S and...

5 years ago | 0

Answered
How to plot a deviation (upper/lower limit)
Include 1.05*signal and 0.95*signal in the same plot.

5 years ago | 1

Answered
How to calculate the area under curve?
area_under_curve= trapz(x,y)

5 years ago | 1

| accepted

Answered
lsqcurvefit to estimate parameters in ODE45
Modifications in the following lines are necessary: [ ... ] = lsqcurvefit(@(theta,t) kinetics(theta,t,precision),...) function...

5 years ago | 0

Answered
How to create a function handle for thermodynamics(semi-infinite heat conduction) using erfc with multiple variables?
Use ./ instead of / in your definition of thetafh. But you are asked to write a function, not a function handle.

5 years ago | 0

| accepted

Answered
How to separate real and imaginary value into different column?
A = [real(v),imag(v)]; if v is the column vector with 1024 complex numbers.

5 years ago | 0

| accepted

Answered
How to code erf(z) summation series?
function main z = [0.1 0.5 1 2]; for i=1:numel(z) [erfc1(i),n(i)] = myerfc1(z(i)); end erfc_matlab = erfc(z); X = [z.',...

5 years ago | 0

| accepted

Answered
How can I solve this partial differentiation equation numerically?
A = zeros(M+1); U2 = zeros(M+1,N+1); A(1,1) = 1; for i=2:M A(i,i-1) = -sigma; A(i,i) = 1+2*sigma; A(i,i+1) = -sigma;...

5 years ago | 0

| accepted

Answered
(Solved) Help with please these are hard
function [n,summa] = threshold(limit) summa = 0; n = 0; while summa <= limit n = n+1; summa = summa + 5*n^2 - 2*n; end...

5 years ago | 0

| accepted

Answered
Derivative of a function of three variables
syms y S K C(y,S,K) =exp(-y*sqrt(S*K)); g = gradient(C(y,S,K),[y,S,K])

5 years ago | 1

| accepted

Answered
Integrate a random function
Matlab tools can not be used for this problem because the integral is not simply a numerical value, but a random variable itself...

5 years ago | 0

| accepted

Answered
Solve partial differential equations coupled
There is no matlab code that can solve this problem directly. Look at the CLAWPACK package available in the internet.

5 years ago | 1

| accepted

Answered
summing columns based on certain interval
sum(sum(A(1:51,:))) sum(sum(A(53:102,:))) sum(sum(A(104:153,:)))

5 years ago | 0

Answered
How to draw graph of the following function?
function main a = 1; nu = 2; d0 = 0; nu0 = 1; n = 15; deltat = 0.05; % end of user inputs T = 0:deltat:n ; M = [(1-a/nu...

5 years ago | 1

| accepted

Answered
How to predict furure values in a non linear regression?
Naive procedure: If your fitting curve depends on time t, evaluate it at the future time instant you have in mind. But be very...

5 years ago | 0

Answered
How to create Matrix of known dimensions with random values?
For random numbers uniformly distributed on [0,1] : A = rand(5,3);

5 years ago | 0

Answered
Calculate perpendicular line to an 3rd order polynomial
For a general function f, the formula for the perpendicular line to the function through (x0,f(x0)) is y = f(x0) + (x-x0)* ( -1...

5 years ago | 0

| accepted

Answered
PDEPE coupled boundary condition help
dX^bar/dt = 3/R * D_ap * dX/dr (@r=R) For dX/dr (@r=R) you can insert the right-hand side of your second boundary condition for...

5 years ago | 0

| accepted

Answered
Plotting General Solution Of Differential Equation
Maybe sol = dsolve(eq); sols = subs(sol,[C1,C2,C3,C4],[-1,-1,-1,-1]); fplot(sols,[-10,10])

5 years ago | 0

Answered
How to quickly find the indecies of elements in an array?
indices = find(A==B)

5 years ago | 0

Answered
how to arrange x-coordinate w.r.t y-coordinates?
Something like As = sortrows(A); x = As(y(:)+1,1) where y is the vector of y-coordinates ?

5 years ago | 0

| accepted

Answered
how to solve this nonlinear equation?
function main p=0.1:0.5:10; gss0 = 1.0; for i=1:numel(p) gss(i)= fzero(@(x)fun(x,p(i)),gss0) gss0 = gss(i); end plo...

5 years ago | 0

| accepted

Load more