Respondida
Problem with simulating with SEIR variant
I get your results for I, Q and D. See them clearly by changing your Main section to; %SEIAQRD_Main to = 1; tf = 365; tspan...

casi 6 años hace | 1

| aceptada

Respondida
cycle for integrating vector sections
Perhaps you should have something like: for i=1:4:length(Fi)-2 x=Fi(i:i+2); % +2 I need to integrate sections (3 values ​​...

casi 6 años hace | 0

Respondida
Find all possible unique combinations of weights of 3 assets
Here's a brute force and ignorance method: c = 0; n = []; for i=0:100 for j=0:100 for k=0:100 if...

casi 6 años hace | 1

| aceptada

Respondida
How to code an ODE System with paramters depending on variables
You can include the body of each "extra" function directly in the main function: function dYdt = System(t,Y) i_L = Y(1...

casi 6 años hace | 0

Respondida
Conversion of a Fortran Equation to Matlab
This is the correponding MATLAB structure: for N = 1:TIMEF TCALC(N) = TEXP(1); for J = N:-1:1 ...

casi 6 años hace | 0

| aceptada

Respondida
Branch Choice for Arguments of Complex Numbers in MATLAB
Can you use mod(angle, 2*pi) or mod(angle, -2*pi) as appropriate?

casi 6 años hace | 0

Respondida
I want to write a code for Fano lineshape fit.
Create a function that calculates the sum of squared differences (SS) between your function and the measured values, and then us...

casi 6 años hace | 0

Respondida
how to calculate the temperature of a thin rod using finite elements with the galerkin method? heat 1-d
I've attached a solution of the thin rod problem using the Galerkin FE approach. The attached is in Live Editor format so that...

casi 6 años hace | 0

Respondida
How to collapse within a column vector
One possibility is: x = 1:12; for i = 1:length(x)/3 p = 3*(i-1)+1; y(i) = sum(x(p:p+2)); end

casi 6 años hace | 0

Respondida
How to solve multiple DOF mass-spring linear system with attached resonators with ode45?
Something like this perhaps (but use your own data!): % Initial conditions u = zeros(length(tspan),length(x)); p = u; p(1,N/2...

casi 6 años hace | 0

Respondida
how to discretize a nonlinear model using Matlab
This is a simultaneous, linear system. You could do something like the following (replacing my arbitrary data with your actual ...

alrededor de 6 años hace | 0

| aceptada

Respondida
I need matlab code for optimization of the particle swarm (PSO)
Search pso on the Matlab File Exchange.

alrededor de 6 años hace | 0

| aceptada

Respondida
I am having a problem in doing assignment at Coursera
Your code has the limit 18 rather than 21. Given that, it produces the correct result. If you want the words true or false r...

alrededor de 6 años hace | 0

Respondida
draw a simple complex function
How about: x0 = 1; y0 = 2; z0 = x0 + y0*i; R = abs(z0); theta = 0:1/360:2*pi; x = x0 + R*cos(theta); y = y0 + R*sin(th...

alrededor de 6 años hace | 0

Respondida
Effect of Step Size ODE
Quite a few changes needed! F=@(t,y) 200*(y+0.01).^2*(0.2-y); %Initial Value Problem m = input ('Please choose the first m...

alrededor de 6 años hace | 0

Respondida
Euler's method to plot orbital trajectory of comet
It's the vpa function slowing everything. There is no need for it here. Try the following: % Euler's Method % Initial condit...

alrededor de 6 años hace | 0

Respondida
A problem with a "Recursive Function"
You could try the following: syms a b n=5; eqn=b==Recursive(n); a=solve(eqn,a); disp(a) function r=Recursive(m) ...

alrededor de 6 años hace | 0

| aceptada

Respondida
Generate manual repeatable signal for matlab
Like this? dt = 0.01; tf = 1.5; n = tf/dt + 1; for i = 1:n t(i) = (i-1)*dt; y(i) = wave(t(i)); end plot(t,y)...

alrededor de 6 años hace | 0

| aceptada

Respondida
Subplot in a for loop with different graphs
Something like this perhaps (though the labelling could be tidied up!): a = 0; b = 3; yt = @(t) 5.*exp(-t).*(-1 + sin(10.*t))...

alrededor de 6 años hace | 0

Respondida
fixed bed adsorption column model-solving PDE-freundlish isotherm
The following works. I can't say if the result is sensible or not - you will need to judge that. I'm not convinced that the co...

alrededor de 6 años hace | 1

Respondida
How to create bar plot with groups x-axis labels
Here's one way (there are almost certainly slicker ways!): % Arbitrary data x = 0:10:70; y = [ 5 2 3 7 8 1 7 4]; % Labels L...

alrededor de 6 años hace | 7

| aceptada

Respondida
Runge Kutta Loop and save array of results to workspace
Here's one way: p=1:0.2:5; h=0.15; x = 0:h:3; ...

alrededor de 6 años hace | 0

| aceptada

Respondida
Undefined unary operator '-' for input arguments of type 'string error
Why not just: y1 = [0,0,0,0,0,0,0,0,0,0,0,0.04,0.32,0.56,0.08,0,0,0,0,0,0,0,0,0,0]; y2 = [0,0.05,0.05,0.05,0,0.1,0,0,0.2,0.3,0...

alrededor de 6 años hace | 0

Respondida
Using RK4 to solve an equation of one variable only
The code you found is, in fact, for just one dependent variable (y). It is also updating the independent variable (t). Try the ...

alrededor de 6 años hace | 1

| aceptada

Respondida
I would like to store store the change in temp in each node for each time step
I think the following does your desired calculations: %Parameters rho = 1; %density, kg/m^3 cp = 1; %specific heat, J/kgK K ...

alrededor de 6 años hace | 0

Respondida
What did I do wrong here?
I answered this here: https://uk.mathworks.com/matlabcentral/answers/559760-how-to-do-this-problem#answer_461267?s_tid=prof_co...

alrededor de 6 años hace | 0

Respondida
How to do this problem?
Try this: u0 = 5000; % This is the code that I wrote lambda = 0.03; pm = 9000; k = 100; f = @(t,p) lambda*p*(1-p./pm)-k; [...

alrededor de 6 años hace | 0

Respondida
How to make an if condition where strings are involved?
Try replacing letter~=alphabet with ~any(strcmp(alphabet,letter))

alrededor de 6 años hace | 1

Respondida
how to use reshape ?
If A is your 23043864x3 matrix, then B = reshape(A, 339, 203928); should work. Of course, you could simply use A where I've ...

alrededor de 6 años hace | 0

Respondida
How to solve y''+y'-2y=x
Something like this perhaps: Y0 = [2 5]; % intial conditions xspan = [0 5]; % x-boundary values % ode solver [x, Y] = ...

alrededor de 6 años hace | 0

| aceptada

Cargar más