Risposto
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...

oltre 6 anni fa | 1

| accettato

Risposto
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 ​​...

oltre 6 anni fa | 0

Risposto
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...

oltre 6 anni fa | 1

| accettato

Risposto
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...

oltre 6 anni fa | 0

Risposto
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 ...

oltre 6 anni fa | 0

| accettato

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

oltre 6 anni fa | 0

Risposto
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...

oltre 6 anni fa | 0

Risposto
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...

oltre 6 anni fa | 0

Risposto
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

oltre 6 anni fa | 0

Risposto
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...

oltre 6 anni fa | 0

Risposto
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 ...

oltre 6 anni fa | 0

| accettato

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

oltre 6 anni fa | 0

| accettato

Risposto
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...

oltre 6 anni fa | 0

Risposto
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...

oltre 6 anni fa | 0

Risposto
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...

oltre 6 anni fa | 0

Risposto
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...

oltre 6 anni fa | 0

Risposto
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) ...

oltre 6 anni fa | 0

| accettato

Risposto
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)...

oltre 6 anni fa | 0

| accettato

Risposto
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))...

oltre 6 anni fa | 0

Risposto
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...

oltre 6 anni fa | 1

Risposto
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...

oltre 6 anni fa | 7

| accettato

Risposto
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; ...

oltre 6 anni fa | 0

| accettato

Risposto
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...

oltre 6 anni fa | 0

Risposto
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 ...

oltre 6 anni fa | 1

| accettato

Risposto
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 ...

oltre 6 anni fa | 0

Risposto
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...

oltre 6 anni fa | 0

Risposto
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; [...

oltre 6 anni fa | 0

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

oltre 6 anni fa | 1

Risposto
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 ...

oltre 6 anni fa | 0

Risposto
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] = ...

oltre 6 anni fa | 0

| accettato

Carica altro