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

Answered
Newton's method returns NaN when solving
If you rename y(1)= x(3)+x(6) and y(2)=x(1)*x(7) in your equations for f1,...,f7, you will see that you have 7 equations for 5 u...

3 years ago | 0

| accepted

Answered
How can I isolate and subplot June from the whole year?
% Initialise clear close all clc % Load data filename='DevonportTides2014.txt'; A=readtable(filename,'Headerlines',1); d...

3 years ago | 0

| accepted

Answered
How to sum up the functional sequence correctly?
t = (100:1000).'; n = 0:49; Ef = 2.77e3; Kb = physconst('boltzmann'); % 1.38*10^(-23) m = 9.1093837e-31; Tc = 1.2; D = 1e-...

3 years ago | 0

Answered
"User supplied objective function must return a scalar value." error using fminbnd
syms a x = sym('x',[2,1]); fun(x) =(18.*x(2)-0.2.*(x(1)-20).^2).^2 + (20.*x(1)-0.1.*(x(2)-10).^2).^2; %function is defined g ...

3 years ago | 0

| accepted

Answered
How do i add a time vector to a existing table?
Shouldn't it be Tijd = (0:0.02:4000*0.02).' ?

3 years ago | 0

| accepted

Answered
Which optimization method is better for problems with random steps
This seems to be a stochastic optimization problem. None of the optimizers from the optimization toolbox can cope with random ou...

3 years ago | 0

Load more