Answered
How do i solve differential equation 2nd oder simbolically and numerically?
syms t y(t) sigma(t) eqn_diff = diff(y,t,2)+3*diff(y,t)+y(t)-2*sigma(t)==0; ysol(t) = dsolve(eqn_diff); var = symvar(ysol) e...

4 years ago | 1

| accepted

Answered
How to solve method of lines on one-dimensional heat equation using Euler's method?
% Parameters k = 0.5; % Evaluate BC dx = 0.01; x = 0:dx:1; dt = 0.0001; t = 0:dt:0.5; h = 1/(length(x)-1) ; %step size ...

4 years ago | 0

| accepted

Answered
I need help to make graphs please
See above. I added four lines to your code to plot the results and changed the line flux(index)=fluxp+fluxe0+fluxe1+fluxe2; to...

4 years ago | 1

| accepted

Answered
The proper way to sample 3 normally or lognormal distributed variables added up to 1
You can define a common probability distribution of the three variables on the triangle x + y + z = 1, x, y, z >= 0 but this c...

4 years ago | 0

Answered
How can I constrcut this matrix for a problem?
If x = [x0,x1,...,xn] is an 1x(n+1) row vector, you could use M = zeros(n+1); for i = 1:n+1 M(i,:) = psi(x(1:n+1)-x(i)); ...

4 years ago | 0

| accepted

Answered
Are the algorithms used in mldivide direct solvers?
Are the algorithms used by "mldivide" for any input direct solvers (not matter if (not) sparse, (not) symmetric, (not) banded et...

4 years ago | 0

Answered
how to write an equation the it is function of itself (solar cell current equation)
I guess you want to solve for J ? Then define fun_J = @(J) J - (J_PH - J0*(exp(q*(V+J*R_S)/(k_B*T))-1)-(V+J*R_S)/R_SH) and u...

4 years ago | 0

Answered
How to write the below equation in MATLAB
R = gammainc(x/theta,k)

4 years ago | 0

Answered
routing problem optimization code
https://math.stackexchange.com/questions/1658457/longest-path-with-constraint

4 years ago | 0

Answered
why do I get "Array indices must be positive integers or logical values"
Most probably you mean Dnorm = Dsm./Dstd instead of Dnorm = Dsm./Dstd(D)

4 years ago | 0

| accepted

Answered
how to reduce its computing time?
Here is the code for the first loop. You can do it for the other loops in the same manner. u=[30 40 50 70]; b=u; [~,C]=size(b...

4 years ago | 0

| accepted

Answered
I have to output results (z1 and z2) so the minimum value in Z1 I want to find the value in the same index in Z2, they are 4 rows and 9 columns.
%the output of the code are 2 tables z1 and z2, each consists of 4 rows and 9 coloumns, so if the the minimum value in z1 coloum...

4 years ago | 0

Answered
I'm not getting any output here, can anyone please tell me what's the issue here?
for i=1:(length(time)-1) instead of for i=1:(length(t)-1)

4 years ago | 0

Answered
Automating the derivation of sensitivity indices
You could use syms beta_s alpha_a alpha_u mu q_i gamma_a eta_i eta_u beta_s_num = 0.274; alpha_a_num = 0.4775; alpha_u_num =...

4 years ago | 1

Answered
Pdepe: Spatial discretization has failed. Discretization supports only parabolic and elliptic equations, with flux term involving spatial derivative.
At the moment, you set as boundary conditions du/dx + u*dv/dx = 0 at x=0 and x=1 Check whether this is really what you want. ...

4 years ago | 1

| accepted

Answered
solve system of equations imposing two variables not to be equal
Solution is C1 = C2 = 1 v11 = l11, v12 = l12, v21 = l21, v22 = l22 v11 = l31, v12 = l32, v21 = l41, v22 = l42 So if l11 = l...

4 years ago | 0

| accepted

Answered
hi i am trying to get the output of this loop in one matrix to use it in another function can anyone help me ?
z = acos(0.9); v = [ 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 .9 1]; % d = -z + acos(v*cos(z)) is (one) solution of (v/0.06)*tan(z)*s...

4 years ago | 0

| accepted

Answered
How to use ODE function for modelling tanks in series
xa_in = 0.3; % inital concentration of A flowing in. xa = 1.0; % inital concentration of A in the reactor 1. tend = 15; %runti...

4 years ago | 1

| accepted

Answered
Doing a nested numerical integral in Matlab
mu = -20:0.01:20; f = @(mu) integral2(@(u,sigma) sin(mu*sqrt(1-sigma.^2).*cos(pi/2*u)).*(sin(mu*sigma/2)).^2,0,1,0,1); P = arr...

4 years ago | 0

| accepted

Answered
The size of X must match the size of Z or the number of columns of Z.
Errors in coding and discretization have been corrected, I guess. Why did you delete your previous question ? Quite impolite in...

4 years ago | 0

Answered
Solving equation with two solutions
syms M F = M*exp(-M^2/2)==0.2; vpasolve(F, [1 Inf])

4 years ago | 0

Answered
how to save a matrix in each iteration in different variables
Before entering the outer loop, initialize "vol" as vol(nouter,11,4) where nouter is the number of outer loops and save the re...

4 years ago | 0

Answered
How do I extract a 2-D matrix from a 3-D matrix using a row number as index
M_3d = rand(2,6,2) M_2d_1 = squeeze(M_3d(1,:,:)) M_2d_2 = squeeze(M_3d(2,:,:))

4 years ago | 1

| accepted

Answered
Limiting range of a matrix
A = [1 2 3 4 5 6 7 8]; A(A<3) = 3; A(A>6) = 6; A

4 years ago | 1

Answered
fsolve with vectors x and y (not x(1) x(2))
%defining constants: N_mesh=3; %define the problem for fsolve problem.objective = @(z)EquationsList(z,Nmesh); %initial poin...

4 years ago | 2

Answered
I want to fit the data with the mathematical model containing numerical integration, please help me!
%AIfit.m %function par = AIFit load('GST33.mat','Expression1'); xdata = Expression1(:,1); ydata = Expression1(:,...

4 years ago | 1

| accepted

Answered
[Ask Help] - Monte Carlo Coin Flip
Add the lines E = sum(coin); M = max - E; probOf0 = M / max probOf1 = E / max to your code. But your way to generate the ...

4 years ago | 0

Answered
dijkstra algorithm function problem
Works for me. %--------------------------------------------------- % Dijkstra Algorithm % author : Dimas Aryo % email : mr.d...

4 years ago | 0

Answered
how to calculate a double integral with simpson rule?
If your "simpson" function accepts matrix inputs for the function values on a 2d-grid in x/y direction, you might want to study ...

4 years ago | 0

| accepted

Answered
3-D Countour Plot based on velocity data
xyzu = readmatrix('velocity3d.txt'); x=xyzu(:,1); y=xyzu(:,2); z=xyzu(:,3); u=xyzu(:,4); F = scatteredInterpolant(x,y,z,u);...

4 years ago | 1

| accepted

Load more