Answered
How to stop data being overwritten in for loop?
In the outer loop, by initializing all vectors to 0, you overwrite all the settings done in the inner loop. Furthermore, I gues...

4 years ago | 1

Answered
Optimisation using intlinprog for a portfolio
[x1,fval1,exitflag1,output1] = intlinprog(-f,intcon,A,b,[],[],lb,ub)

4 years ago | 0

| accepted

Answered
Save Variable from ODE45
Try this: figNum = 1; %% System Parameters % Aircraft M = 5e4; % mass [kg] J = 1.25e4; % moment of inertia [kg.m^2] g ...

4 years ago | 0

Answered
How to randomly select coordinates from given set of data?
A = [1 2; 3 4; 5 6; 7 8; 9 0]; imat = randi(size(A,1)); selected_row = A(imat,:)

4 years ago | 0

Answered
Need help with ODE parameter estimation
I have data that shows the infected cases reported every day over a series of days. This will not be enough to separate the dif...

4 years ago | 0

Answered
Save Variable from ODE45
can anyone see what I am missing? You do not pass "options" to ode45.

4 years ago | 0

Answered
Reaction continues even after the concentration is below zero in Simbiology
If the reaction rate of A is proportional to A (as it should be), you usually don't get problems with negative concentrations.

4 years ago | 0

Answered
For Loop through Matrix
rho=2300; %density [kg/m^3] k=1.4; %Thermal conductivity [W/mK] c=880; %thermal coeff [J/kgK] xstart = 0.0; xend = 1.0; n...

4 years ago | 1

| accepted

Answered
Group matrix with this condition
first_column = m3(:,1); v = unique(first_column); for i = 1:numel(v) M{i} = m3(first_column == v(i),2:end) end

4 years ago | 0

Answered
How to optimize the value of x(2)
da = load("C:\Users\Admin\OneDrive - IIT Bombay\Desktop\standard deviation\fragility1.txt")%%Damage state in terms of 0 and 1 W...

4 years ago | 0

| accepted

Answered
I want to generate a random matrix of 3*3 with fixed mean and variance of off diagonal element and for diagonal elements different fixed mean and variance.
A = zeros(3,3); x = logical(eye(size(A))); A(x) = ...; % set diagonal elements x = ~x; A(x) = ...; % set off-diagonal eleme...

4 years ago | 0

| accepted

Answered
How to pass multiple vectors (possibly a matrix) to pdepe and output a respective vector matrix?
optns = odeset('MaxStep',1e-00,'RelTol',1e-7,'AbsTol',1e-7); for i=1:size(alphaa,1) INIT = @(x) alphaa(i,1:3); BC = ...

4 years ago | 0

| accepted

Answered
How to fix an error in my code?
Works for me: op1=input('Enter an number:'); op2=input('Enter an number:'); arith_operator=input('Enter an operator:','s...

4 years ago | 0

Answered
making a table of my results from AdamsBashforth function
f=@(t,y) -y-3*t; F=@(t) 3-3*t-2*exp(-t); t0=0; y0=1; te=20; nn=1:10; h = 1./2.^nn; for ii=1:length(nn) [ys, ts] = MyA...

4 years ago | 1

Answered
Slice in 2D Coordinates
Maybe ax1.ZAxis.Visible = 'off'; % remove z-axis

4 years ago | 0

Answered
Having trouble with multiple boundary conditions while trying to use case function
function res = bc(FL,FR) res = [FL(1,1)-50; FR(1,1)-FL(1,2);FR(2,1)-FL(2,2); FR(1,2)-FL(1,3);FR(2,2)-FL(2...

4 years ago | 1

| accepted

Answered
Plot 4D function with respect to two variables and a parameter
I don't think that you really want to solve the differential equation. To get volumetric data for DY3, you will have to do Sp...

4 years ago | 0

| accepted

Answered
"Spatial discretization has failed" when use pdepe to solve coupled parabolic and elliptic PDEs
First, you should use m = 1 and f = [nu*dudx(1); nu*dudx(2); eta*dudx(3); eta*dudx(4); dudx(5)]; because you work in cyli...

4 years ago | 0

Answered
Vectors must be the same length
y has more or less elements than t. That's why MATLAB does not know how to plot y against t.

4 years ago | 0

Answered
How to multiply 22x1 double with scalar?
If dx = 0 for all i, getting all zeros for delta_x is the right answer. If you want to multiply delta_x by a scalar in a loop, ...

4 years ago | 0

| accepted

Answered
how to use for loop to make simple vector[1 2 3 4 5 6]]
v= zeros(1,6); for i=1:numel(v) v(i) = i; end

4 years ago | 0

Answered
How to integrate given the two data columns
Add the differential equation dz/dt = CURRENT, z(t0) = 0 to your system of ODEs. z will automatically be the integrated CURRE...

4 years ago | 0

Answered
How to transform the uniform random variable into the outcome of a die-throw.
If the random variable is between 0 and 1/6, interprete it as if the result of the dice throw was 1. If the random variable is ...

4 years ago | 1

| accepted

Answered
Using custom fit equation for surface
ft = fittype('a + b*x + c x^2 + d*y^2','dependent',{'z'},'independent',{'x','y'},'coefficients'{'a','b','c','d'})

4 years ago | 1

| accepted

Answered
estimating parameters by lsqcurvfit
Although this has been answered several times already, here we go again: data = [ 1 25 2 75 3 227 4 296 ...

4 years ago | 1

Answered
How to solve symbolic problem for two equal matrices?
If you add the two lines [A,b] = equationsToMatrix(C_rot - C==0); rank(A) you'll see that rank(A) = 9. Thus your system o...

4 years ago | 1

| accepted

Answered
Can someone explain why I am getting the error "Not enough input arguments (line 26)"?
[M,y] = Newton_3(@my_func,@my_func_pr,0.1,0.001,1e6); function [M,y]=Newton_3(fun,fun_pr,M1,tol,max) % Find zero near x1 usi...

4 years ago | 1

| accepted

Answered
Error using Nonlcon: "Not Enough Input Arguments"
[x,fval,exitflag,output,population] = ga(fitnessfcn,nvars,A,b,Aeq,beq,Lb,Ub,@nonlcon,intcon); instead of [x,fval,exitflag,outp...

4 years ago | 1

Answered
Problem with my forward euler scheme
%parameters c = 0.05; %Velocity Nx = 50; % Number of spatial steps xl = 0; % Left boundary xr = 4; ...

4 years ago | 0

| accepted

Answered
Matrix Dimensions must agree.. Help Please
You work with vectors. So you must use v = (g./f).*dh_x./dx; % Meridional geostrophic velocity v u = -(g./f).*dh_y./dy...

4 years ago | 0

Load more