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

Answered
Is there a way to get a higher order polynomial fit for a surface than poly55
You can define the fitting polynomial by yourself. Everything is allowed, but does it really make sense to use polynomials of de...

4 years ago | 0

| accepted

Answered
Forward Euler method error
Array indices in MATLAB start at 1, not at 0. Thus you will have to replace x(0)=1 y(0)=0 by x(1)=1 y(1)=0 And you sol...

4 years ago | 0

| accepted

Answered
Fitting rigid bodys of 3 coordinates in 2D. Minimization with fminsearch does not work for optimization
You forgot to square the difference between the two triangles.

4 years ago | 1

| accepted

Answered
using solve to solve equation with fractional power?
There are no analytical expressions for the roots if a polynomial of degree >= 5. So there is nothing you can do but to give nu...

4 years ago | 0

Answered
What does the 'greater then' symbol mean if it is after an equality?
The logical expression x*w(:,2) > x*w(:,1) is a vector of length size(w,1) and evaluates to 1 if x*w(i,2) > x*w(i,1) and to 0...

4 years ago | 1

Answered
converting row and column
By default, all one-dimensional vectors are row vectors. But if you initialize Kc as a column vector, you'll get Kc a column ve...

4 years ago | 1

| accepted

Answered
Solve the following simultaneous equations:
theta=0.10895; YF=0.0667; alpha= 0.29; beta= 0.68; gamma1=450; gamma2=11.25; X0=0; Y0=0.0667; Z0=0; f=@(t,y)[-y(1)/theta+...

4 years ago | 1

Answered
Solve an equation with matrices
syms tii too tc q rh eqn = (tii-too) == q*rh*log((tc-too)/(tc-tii)); tc = solve(eqn,tc); Tc = double(subs(tc,[tii,too,q,rh],[...

4 years ago | 1

Load more