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

3 years ago | 0

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

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

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

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

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

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

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

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

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

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

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

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

3 years ago | 0

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

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

3 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,:,:))

3 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

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

3 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(:,...

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

3 years ago | 0

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

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

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

3 years ago | 1

| accepted

Answered
Error using quantiz The codebook must be a real vector whose length is one more than the length of the partition. How to resolve this issue in the following code attached?
codebook = [min(C):(max(C)-min(C))/2^n:max(C)]; instead of codebook = [min(C):(max(C)-min(C)/2^n):max(C)];

3 years ago | 0

Answered
Why quadprog fvalue3 & fmincon fvalue1 are not same in the example below?
Should be H = double(hessian(Rtot,X)); instead of H = 0.5*double(hessian(Rtot,X)); since Rtot(x) = Rtot(0) + f.'*x + 0.5*x...

3 years ago | 1

| accepted

Answered
How to set a vector as initial condition for PDEs?
Generate two data vectors R and C0 where R covers the complete spatial interval of integration. Then function c0 = pdex2ic(r,...

3 years ago | 0

| accepted

Answered
When Lambda reaches a value of approximately 1.33, the code gives an error value.
%Imperfection t0 = 0.01333; %Half of a strut length = 1.5; %Define the length a=0; b=length; s = linspace(a,b,100); ...

3 years ago | 0

| accepted

Answered
Finding the first intersection point between 2 lines
If you have the t-y values as vectors available, you can use this code to determine the t-values where y-y_tau=0: y_tau = 0.63*...

3 years ago | 0

Answered
Solving 5 very complicated equations with 5 unknowns
syms f1 f2 f3 f4 fe p2 p3 fl = @(f1, f2, d) 1/(1/f1 + 1/f2 - d/(f1 * f2)); %focal length formula bfl = @(f1, f2, d) (f2 * (d -...

3 years ago | 1

| accepted

Load more