Answered

lsqcurvefit to estimate parameters in ODE45

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

lsqcurvefit to estimate parameters in ODE45

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

2 months 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.

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.

2 months 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.

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.

2 months 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.',...

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.',...

2 months 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;...

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;...

2 months 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...

(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...

2 months 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])

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])

2 months 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...

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...

2 months 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.

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.

2 months 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,:)))

summing columns based on certain interval

sum(sum(A(1:51,:))) sum(sum(A(53:102,:))) sum(sum(A(104:153,:)))

2 months 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...

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...

2 months 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...

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...

2 months 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);

How to create Matrix of known dimensions with random values?

For random numbers uniformly distributed on [0,1] : A = rand(5,3);

2 months 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...

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...

2 months 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...

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...

2 months 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])

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])

2 months ago | 0

Answered

How to quickly find the indecies of elements in an array?

indices = find(A==B)

How to quickly find the indecies of elements in an array?

indices = find(A==B)

2 months 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 ?

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 ?

2 months 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...

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...

3 months ago | 0

| accepted

Answered

ode15s and 0de23 very slow at high frequencies

I have no experience with the physical background, but if for low frequencies, the solution somehow looks like sin(0.001*x) and ...

ode15s and 0de23 very slow at high frequencies

I have no experience with the physical background, but if for low frequencies, the solution somehow looks like sin(0.001*x) and ...

3 months ago | 1

| accepted

Answered

Sum of elements of a matrix such that no row or column repeats

p = randperm(n); sum = 0.0; for k = 1:n sum = sum + a(k,p(k)); end where a is the nxn matrix.

Sum of elements of a matrix such that no row or column repeats

p = randperm(n); sum = 0.0; for k = 1:n sum = sum + a(k,p(k)); end where a is the nxn matrix.

3 months ago | 0

| accepted

Answered

Index in position 3 exceeds array bounds (must not exceed 1).

You overwrite C when you call contourf.

Index in position 3 exceeds array bounds (must not exceed 1).

You overwrite C when you call contourf.

3 months ago | 0

| accepted

Answered

Integrating the results of state space output(ode45)

Alternatively to the solution I suggested previously, you can use Matlab's "cumtrapz".

Integrating the results of state space output(ode45)

Alternatively to the solution I suggested previously, you can use Matlab's "cumtrapz".

3 months ago | 0

Answered

potting the integral of a state

If y'(t)=f(t,y) is the state space equation, you get the integral of y by simultaneously solving z'(t)=y(t), z(0)=0.

potting the integral of a state

If y'(t)=f(t,y) is the state space equation, you get the integral of y by simultaneously solving z'(t)=y(t), z(0)=0.

3 months ago | 0

Answered

How do I write an inductive sequence?

N = 10; % define number of recurrence terms to be calculated x = zeros(N,1); x(1)...

How do I write an inductive sequence?

N = 10; % define number of recurrence terms to be calculated x = zeros(N,1); x(1)...

1 year ago | 1

| accepted

Answered

substract array elements based on other arrays

setdiff(All,union(R1,R2))

substract array elements based on other arrays

setdiff(All,union(R1,R2))

1 year ago | 1

| accepted

Answered

Solving large sparse Ax=b with lower bound constraint

Did you try starting from the solution of the unconstraint problem ?

Solving large sparse Ax=b with lower bound constraint

Did you try starting from the solution of the unconstraint problem ?

1 year ago | 0

| accepted

Answered

dsolve second order differential equation

dySol=diff(ySol,x); dySol(585.8)

dsolve second order differential equation

dySol=diff(ySol,x); dySol(585.8)

1 year ago | 0

| accepted

Answered

How to plot graph of value of variable when a parameter is varied

Your equations can only be solved for one value of R, namely R = 0.3 + 0.366*exp(-0.3). This can be seen by dividing equation 1...

How to plot graph of value of variable when a parameter is varied

Your equations can only be solved for one value of R, namely R = 0.3 + 0.366*exp(-0.3). This can be seen by dividing equation 1...

1 year ago | 0

Answered

write a function called tri_area returns the area of a triangle with base b and height h

function area = tri_area(b,h) area = 0.5*b*h; end From the command window A = tri_area(3,2)

write a function called tri_area returns the area of a triangle with base b and height h

function area = tri_area(b,h) area = 0.5*b*h; end From the command window A = tri_area(3,2)

1 year ago | 3

| accepted