Answered
Finite Difference Method to find Steady State
T = zeros(6,5); T(1:6,1) = 10; T(1:6,5) = 50; T(1,2) = 73; T(1,3) = 100; T(1,4) = 85; for n=1:5 for i =2:4 T(n+1,...

meer dan een jaar ago | 0

| accepted

Answered
generate random number from a function that serves as PDF ?
N = 1000; U = rand(N,1); n1 = numel(U(U<=w1)); n2 = N - n1; X1 = sigma1*randn(n1,1); X2 = sigma2*randn(n2,1); X = [X1,X2];...

meer dan een jaar ago | 0

Answered
How can I randomly extract a element in a vector?
random_element = v(randi(numel(v)))

meer dan een jaar ago | 0

| accepted

Answered
what numerical approach is used for bvpinit?
In bvpinit, the user just specifies a guess on how the solution of the boundary value problem might look. A numerical method i...

meer dan een jaar ago | 1

Answered
element wise product matrix-vector
Y_t = bsxfun(@times,Y_t,w)

meer dan een jaar ago | 0

Answered
Unexpected output when trying to plot the solution to a system of nonlinear differential equations
Use hold on between the two plot commands.

meer dan een jaar ago | 1

| accepted

Answered
How do I make a function work with vectors?
tanH = (exp(x)-exp(-x))./(exp(x)+exp(-x))

meer dan een jaar ago | 0

Answered
How can I put an integral inside a for loop when the bounds depend on the loop's variable?
Phi_ij1 =@(i,j) integral2(@(y,x) B_zi(i,x,y),0,y_min1(j),0,@(y)x_max1(y,j));

meer dan een jaar ago | 1

Answered
L2 norm of the column
M_norm = normc(M)

meer dan een jaar ago | 0

| accepted

Answered
Curve fitting toolbox - gaussian curve to histogram with no workspace data for the y - value
I think Matlab's "mle" is what you want instead of the curve fitting toolbox.

meer dan een jaar ago | 0

Answered
lsqnonlin and stretched exponential function
error_bounds = nlparci(x,residual,'jacobian',J) after the call to lsqnonlin. If you don't have a toolbox with nlparci, search ...

meer dan een jaar ago | 0

| accepted

Answered
I'm getting an error related to fmincon
If you mean the eigenvalue largest in magnitude, this should give you a start. Incorporating fmincon can automatize the search ...

meer dan een jaar ago | 0

Answered
root of nonlinear equation
ft = @( c ) 0.25* ... instead of ft = 0.25* ...

meer dan een jaar ago | 0

| accepted

Answered
stop Ode45 when y is less than a value
As defined, ode45 expects myEvent to have 2 input parameters, but you use 3. Use Opt = odeset('Events',@(t,u)myEvent(t,u,minu)...

meer dan een jaar ago | 0

| accepted

Answered
How to add the value of the 3 highest elements automatically from a vector?
[~,idx]=maxk(y,3); y(idx)=y(idx)+sx; y

meer dan een jaar ago | 0

Answered
Extracting values that are greater than the threshold
OxygenAlt = Alert(Alert(:,3)>21)

meer dan een jaar ago | 0

Answered
Fitting to an intergral
Use "ArrayValued=true" as option in the call to integral.

meer dan een jaar ago | 1

| accepted

Answered
Hello guys, I need help.
[X1,X2,X3]=ndgrid(x1,x2,x3); Z=f(X1,X2,X3); %assumes f is vectorized M=[X1,X2,X3,Z]; [~,idx]=sort(M(:,4)); sortedM=M(idx,:...

meer dan een jaar ago | 0

Answered
Temperature ramp then keep it at constant temperature
Copy the lines where you define the global parameters to the beginning of function "fun" and remove them in the upper part of th...

meer dan een jaar ago | 1

| accepted

Answered
Best way to solve my implicit equation
Use "fzero" or "fsolve".

meer dan een jaar ago | 1

Answered
How can i implemente this PDE system?
Use "pdepe". You will need to specify four boundary conditions for this solver, although only two for the T equation were neces...

meer dan een jaar ago | 0

| accepted

Answered
For Loop Which Skips Numbers Based on Row Vector
Use "setdiff" to remove the row vector elements from the range of the for-loop and name the vector v. Then simply type for v ...

meer dan een jaar ago | 0

Answered
Euler function where you can define equation, starting x and y values, number of steps and the step length
Use g = f or g = @(x,y) f(x,y) instead of g = @(x,y) f.

meer dan een jaar ago | 0

| accepted

Answered
Integrate for a specific period of time
t=0:.01:10; x = zeros(numel(t)); x(1) = 1; fun_xdot = @(t,x) -2*(x^3) + sin(0.5*t)*x; for i = 1:numel(t)-1 x(i+1) = x(i...

ongeveer 2 jaar ago | 0

| accepted

Answered
Why does fsolve seem not iterate towards the solution?
k = 0.1007; rZ = 12.6518; Rs = 0.164; Cmax = 7.0e-11; W = 1.704e8; iZ = 14.5273; Ls = 1.1e-7; a1 = (k/1000)^2*(rZ-Rs); ...

ongeveer 2 jaar ago | 0

| accepted

Answered
I am getting this error "Index in position 1 is invalid. Array indices must be positive integers or logical values." Kindly help me clear this.
i and j are not defined at this line of your code ; they are first introduced one line later.

ongeveer 2 jaar ago | 0

Answered
Finding Linear regression equation
x = [65 65 62 67 69 65 61 67]; y = [105 125 110 120 140 135 95 130]; X = [ones(numel(x),1),x.']; p = X\(y.'); b = p(1) m ...

ongeveer 2 jaar ago | 0

Answered
Non linear least squares for a system of equations
fun = @(z)[z(1)^0.5*Ydata+z(2)-X1data,... z(1)^0.1*Ydata+z(2)-X2data,... z(1)^0.15*Ydata+z(2)-X3data]; ...

ongeveer 2 jaar ago | 1

| accepted

Answered
How to iterate with fsolve to find Mach number
function main pt2pinf = [1.9, 2.7, 3.5, 4.3, 5.1, 5.9, 6.7, 7.5, 27.5, 47.5, 67.5 ,87.5 ,107.5,127.5, 147.5, 200, 252.5, 305,...

ongeveer 2 jaar ago | 0

| accepted

Answered
Setting of mass matrix
options = odeset('RelTol',1e-9,'AbsTol',1e-9*ones(608,1),'Mass', @(t,y)diag([ones(1,604) sin(t) 1 1 0])); or options = odeset(...

ongeveer 2 jaar ago | 2

Load more