Respondida
When i call and run this code it just save the Phase1 results in CSvV file not other results .
Use PhaseTable = struct2table(PhaseResults); writetable(PhaseTable,'Phase.csv'); instead of % Write Phase re...

casi 2 años hace | 0

Respondida
Calculate the normal vector between two nodes in the space
n = [0 0 1] points from A to B. So I don't understand what you mean by "normal" to the line connecting two points in 3d. Usual...

casi 2 años hace | 0

| aceptada

Respondida
Parse error at observed data
% Observed data (replace with actual data) % Format: [time, infected, isolated, treated, recovered] observed_data = [ 0, ...

casi 2 años hace | 0

Respondida
Multivariate regression for constrained dependent variables
Define a Nx12 matrix A as A = [x11,x12,x13,x14,x15,x16,x21,x22,x23,x24,x25,x26] and a Nx1 vector b as b = ones(N,1) and sol...

casi 2 años hace | 0

Respondida
Newton's method gives NaN. Can someone improve my code?
Your undamped Newton's method throws you from x = 0.5 to x = 46 appr. in the next step. Here, your function cannot be evaluated ...

casi 2 años hace | 0

| aceptada

Respondida
3D integration over a region bounded by some planes.
f = @(x,y,z)x.^2+y+2*z; N = [100,1000,10000,100000,1000000,10000000,100000000]; Fi = zeros(numel(N),1); Fo = Fi; for i = 1:n...

casi 2 años hace | 1

| aceptada

Respondida
Fitting multiple datasets with unique parameters using lsqcurvefit to a normalized function and constraints between datasets.
If your model functions share common parameters, you must run "lsqcurvefit" on all yi with all parameters present (in your case ...

casi 2 años hace | 0

Respondida
Error in Model Fitting
% Define the time vector and observed data time = [0, 1, 2, 3, 4, 5]; % Example time points observed_I = [10, 15, 20, 25, 30, ...

casi 2 años hace | 1

| aceptada

Respondida
Complex Number Ignition Error: Ray transfer matrix analysis
imag(1./q)*lambda/pi is negative, thus sqrt(imag(1./q)*lambda/pi) is complex. MATLAB does not know how you want it to plot ...

casi 2 años hace | 0

Respondida
Solving with ode45 with a solution dependant variable in the ode
fun = @(t,y) sum(y)*y; zspan = [0 3e-2]; y0 = [1 2 3 4 5]; [T,Y] = ode45(fun,zspan,y0); plot(T,Y)

casi 2 años hace | 0

| aceptada

Respondida
I'm getting a matrix as output when I'm expecting a vector
Maybe you mean I = ones(n+1,1); instead of I = ones(n+1);

casi 2 años hace | 2

Respondida
multiplying a function handle by a constant
This is Heun's method, but your solution explodes. I get the same results with a MATLAB ODE integrator like ODE45. You will hav...

casi 2 años hace | 0

Respondida
Problems by calculating zero points of a cubic function
x=0.1:0.1:0.5; p = arrayfun(@(i)roots([-2 1 x(i) -8]),1:numel(x),'UniformOutput',0); p = cell2mat(p)

casi 2 años hace | 0

| aceptada

Respondida
I'm getting following error: Array indices must be positive integers or logical values.
Indexing in MATLAB starts with 1, not with 0.

casi 2 años hace | 1

Respondida
Error imposing space-derivative-dependent boundary condition with solvepde using variable state.uy - Error: Unrecognized field name "uy".
According to the documentation (User's guide, page 2-128), g can be a function of x,y,t and u. The boundary condition of a seco...

casi 2 años hace | 0

| aceptada

Respondida
How to build an empiric cdf/pdf of a compound poisson continuos distribution
clear all; close all; clc rng(200724) %mean and standard deviation of a given sample (sample of Yi) mu_c = 4432.62; var_c= 53...

casi 2 años hace | 0

| aceptada

Respondida
Invalid expression during a function handle
Must read Kernel = @(x) ... instead of Kernel = @x ...

casi 2 años hace | 2

Respondida
Help understanding how function handle is used
Somewhere in your code you defined a fitness function which assumes that inputs j and k are integers function fitness = Ft(x,j,...

casi 2 años hace | 0

| aceptada

Respondida
Error in for loop: Index exceeds matrix dimensions.
matrix_f=[1 2 3; 1 2 3; 4 5 6; 7 8 9; 7 8 9; 10 11 12]; unique(matrix_f,'stable','rows') Note that this code will remove all d...

casi 2 años hace | 1

Respondida
Why does this technique not work?
I already gave you the code how to order a vector according to the ordering of "u". Why don't you use it ? Your method is wrong...

casi 2 años hace | 1

| aceptada

Respondida
Setting unknown constants in equation for known data
how can i do that ? By solving the system yi - f(xi,a,b,c) = 0 for a,b and c. Here, (xi,yi) are your data points. If f is l...

casi 2 años hace | 1

Respondida
lsqcurvefit issues due to variables being several orders of magnitude different
load('V1.mat') load('Vp.mat') load('data.mat') V = [V1, Vp]; %voltages a = 1.1792; b = 0.5; e = 1.60217662e-19; Area ...

casi 2 años hace | 0

Respondida
Please help me understand output from discretize
X=[.01:.01:1] ; % - example data uniformly going form .01 to 1 in steps of .01 binEdges=[0:0.01:1]; %- the bind edges X(6)>b...

casi 2 años hace | 0

| aceptada

Respondida
How can I solve the error "Unable to solve the collocation equations -- a singular Jacobian encountered" in bvp4c?
Your ODE system is linear - thus you can determine its general solution having 7 free parameters. But incorporating of your boun...

casi 2 años hace | 0

| aceptada

Respondida
How to Graph integrals?
According to proposition 4, the red curve should be the inverse bidding function X and the blue curve should be the inverse bidd...

casi 2 años hace | 0

| aceptada

Respondida
how to plot function with 2 variables? using fsolve or bisection ?
Use "fimplicit": https://uk.mathworks.com/help/matlab/ref/fimplicit.html

casi 2 años hace | 0

Respondida
how to get a good estimate of the positive parameters that will give a good fit of the curves to real data?
You should avoid defining the same data, parameters and variable definitions multiple times in your code (specific_data, gamma, ...

casi 2 años hace | 1

| aceptada

Respondida
How can I find a unique solution within tolerance using solve?
As long as rank(A) equals 3 in the below code, your system of linear equations has a unique solution. syms Rx Risop Rison V1=2...

casi 2 años hace | 1

Respondida
function must return a column vector
Allocate dy as a column vector before assigning values to it: %Ordinary differential equation dy = zeros(4,1); dy(1)=alpha*(1...

casi 2 años hace | 0

Respondida
I'm having trouble solving a system of nonlinear equations with the fmincon function.
Use % Options for fmincon options = optimoptions('fmincon', 'Algorithm', 'interior-point', 'Display', 'off','ConstraintToleran...

casi 2 años hace | 0

| aceptada

Cargar más