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

oltre 6 anni fa | 0

| accettato

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

oltre 6 anni fa | 2

| accettato

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

oltre 6 anni fa | 0

| accettato

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

oltre 6 anni fa | 0

| accettato

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

oltre 6 anni fa | 0

| accettato

Risposto
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,:)

oltre 6 anni fa | 0

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

oltre 6 anni fa | 0

| accettato

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

oltre 6 anni fa | 1

| accettato

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

oltre 6 anni fa | 1

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

oltre 6 anni fa | 0

| accettato

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

oltre 6 anni fa | 0

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

oltre 6 anni fa | 0

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

oltre 6 anni fa | 0

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

oltre 6 anni fa | 0

| accettato

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

oltre 6 anni fa | 0

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

oltre 6 anni fa | 0

| accettato

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

oltre 6 anni fa | 0

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

oltre 6 anni fa | 0

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

oltre 6 anni fa | 0

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

oltre 6 anni fa | 0

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

oltre 6 anni fa | 1

| accettato

Risposto
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

oltre 6 anni fa | 0

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

oltre 6 anni fa | 0

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

oltre 6 anni fa | 0

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

oltre 6 anni fa | 0