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

fast 6 Jahre vor | 1

| akzeptiert

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

fast 6 Jahre vor | 0

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

fast 6 Jahre vor | 1

| akzeptiert

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

fast 6 Jahre vor | 0

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

fast 6 Jahre vor | 0

| akzeptiert

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

fast 6 Jahre vor | 0

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

fast 6 Jahre vor | 0

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

fast 6 Jahre vor | 0

Beantwortet
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

fast 6 Jahre vor | 0

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

fast 6 Jahre vor | 0

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

fast 6 Jahre vor | 0

| akzeptiert

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

fast 6 Jahre vor | 0

| akzeptiert

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

fast 6 Jahre vor | 0

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

fast 6 Jahre vor | 0

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

fast 6 Jahre vor | 0

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

fast 6 Jahre vor | 0

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

fast 6 Jahre vor | 0

| akzeptiert

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

fast 6 Jahre vor | 0

| akzeptiert

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

fast 6 Jahre vor | 0

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

fast 6 Jahre vor | 1

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

fast 6 Jahre vor | 7

| akzeptiert

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

fast 6 Jahre vor | 0

| akzeptiert

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

fast 6 Jahre vor | 0

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

fast 6 Jahre vor | 1

| akzeptiert

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

fast 6 Jahre vor | 0

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

fast 6 Jahre vor | 0

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

etwa 6 Jahre vor | 0

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

etwa 6 Jahre vor | 1

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

etwa 6 Jahre vor | 0

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

etwa 6 Jahre vor | 0

| akzeptiert

Mehr laden