Community Profile

photo

Alan Stevens


Last seen: Today
39 total contributions since 2020

Alan Stevens's Badges

  • Knowledgeable Level 2
  • First Answer

View details...

Contributions in
View by

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

etwa 11 Stunden ago | 0

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

etwa 12 Stunden ago | 0

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

etwa 16 Stunden ago | 0

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

ein Tag ago | 2

| accepted

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

ein Tag ago | 0

| accepted

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

2 Tage ago | 0

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

3 Tage ago | 1

| accepted

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

3 Tage ago | 0

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

4 Tage ago | 0

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

5 Tage ago | 0

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

5 Tage ago | 1

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

7 Tage ago | 0

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

8 Tage ago | 0

| accepted

Answered
Solution to Nonlinear Differential Equation
Here is some example code using arbitrary data: f0 = [0; 1; 2]; % initial conditions tspan = [0 2]; % integration limits ...

8 Tage ago | 0

Answered
I know that my equations are correct, but the error is telling me i need to use logical or positive values
You are trying to index Z1 with 0.01. i.e you are telling MATLAB to to create Z1(0.01). However, the argument to Z1 (and the o...

9 Tage ago | 2

| accepted

Answered
Help with differential equation Kolmogorov in queuing theory
Your code doesn't maintain condition (2) for all times. You should eliminate p6 from equations (1) using condition (2), then us...

11 Tage ago | 0

| accepted

Answered
Boundary conditions for different areas of phi
Firstly, phi is size 1x360, whereas f0 is of size 1x180, but, more importantly perhaps, phi>=0 & phi<10 means you want elements...

11 Tage ago | 0

| accepted

Answered
problem in plotting in a nested while loop in a for loop
Replace the code after count = count+1; with the following to get separate figures (though the curves ae all the same!): fi...

13 Tage ago | 0

| accepted

Answered
splitting a matrix into vectors
Like so: A = [1 2 3; 4 5 6; 7 8 9]; A1 = A(1,:), A2 = A(2,:), A3 = A(3,:)

13 Tage ago | 0

Answered
How to make 2 matrix out of 1 one matrix??
If your first matrix is A, then: ix = find(A>0); B = A; B(ix) = 0; ix = find(A<0); C = A; C(ix) = 0;

15 Tage ago | 0

| accepted

Answered
Extracting data from table hourly wise
Extract the temperatures values from the table as a column vector, then T = reshape(temperatures,24,31)'; Av = mean(T);

16 Tage ago | 1

| accepted

Answered
Changing elements of vector with matrix
One way as follows: a = 0 0 0 0 0 0 0 0 0 0 >> b b = 1 3 6 ...

16 Tage ago | 1

Answered
integral of equation with known boundary
Sorry, i meant "integral". However, there were some other problems, but the code below works: Ep = 1.27; SDB = 0.19 ; Delta ...

17 Tage ago | 0

| accepted

Answered
How can I translate the above psuedocode to
Possibly something like the following (though note that n would need to be 1 greater than the n in your original, because MATLAB...

18 Tage ago | 0

Answered
Reduce computing time ode system
Look at the other triple loop. Similar improvements can be made: for y=1:length(hradialchamber) Aeffettiva_cell(y)=...

19 Tage ago | 0

Answered
Reduce computing time ode system
Here's a start, looking at your triply nested y, k and i loops. % Remove expressions that don't depend on y, k or i from the ...

19 Tage ago | 0

Answered
I have weibull parameters k = 2 and c = 10 m/s for wind speed, how to generate the frequency distribution of wind speed by applying Monte Carlo simulation with sample size N = 8000
How about: >> k = 2; c = 10; >> d = rand(8000,1); r = (log(1./(1-d))).^(1/k)*c; >> histogram(r)

22 Tage ago | 0

| accepted

Answered
Counting number of runs (excluding zeros)?
Try plus1 = sum(data>0) and neg1 = sum(data<0)

24 Tage ago | 0

Answered
Solution for an unknown variable
Something like this (obviously, I've used dummy data): % Initial guess alpha0 = 1; % Call function with fzero alpha = ...

etwa ein Monat ago | 0

| accepted

Answered
Euler's Method
Here's a rather simpler way to do what you want: % EulerEpidemic.m % Data L = 25000; k = 0.00003; h = 0.2; y0 = 250; t...

etwa ein Monat ago | 0

Load more