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

6 years ago | 0

| accepted

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

6 years 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...

6 years 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...

6 years 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...

6 years 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,:)

6 years 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;

6 years 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);

6 years 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 ...

6 years 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 ...

6 years 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...

6 years 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)=...

6 years 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 ...

6 years 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)

6 years ago | 0

| accepted

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

6 years 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 = ...

6 years 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...

6 years ago | 0

Answered
How to calculate detivative of a function with respect to another function
Surely you don't need to do this in Matlab! Just set u = cos(x), so you have d/du(u^2 - 1) = 2u = 2cos(x)

6 years ago | 0

Answered
Euler's method function problem.
How about the following (where I've left out most of your comment sections, but you can easily put them back): %DISEGNO LE SO...

6 years ago | 0

Answered
Why legend something wrong
Instead of loglog(h, A,'k-'); % plot hold on; scatter(h,A,'k','*'); % simply use loglog(h, A, 'k*-'); % with t...

6 years ago | 0

Answered
if statement on vector to replace values
If M is the vector try: ix = (M<0); M(ix) = 0;

6 years ago | 1

| accepted

Answered
create from a vector a vector of cumulative sums
cumsum does exactly that. For example: >> x = [1 3 5 7 9]; >> cumsum(x) ans = 1 4 9 16 25

6 years ago | 0

Answered
How to add a vector to another vector in for loop
One way is to replace T_tot(j)=Tvec; by T_tot((j-1)*8760+i)=Tvec;

6 years ago | 0

Answered
For loop goes longer than expected.
Try for i = 1:(stopSample-startSample+1) y5s_unfiltered(i,1) = y(i,1); % y is the source vector and y5s_unfiltered the de...

6 years ago | 0

Answered
Kindly help me to solve this problem Thanks a lots!!! Non linear shooting method
You don't have multiplication signs between y' and cos and y' and sin: F = @(x,y,z) (y'cos(x)-y*log(y)); FY = @(x,y,z) (-y'si...

6 years ago | 0