Community Profile

photo

Alan Stevens


Last seen: Today
410 total contributions since 2020

Alan Stevens's Badges

  • Knowledgeable Level 4
  • Pro
  • 3 Month Streak
  • First Answer

View details...

Contributions in
View by

Answered
contour plot of stream function for a tornado
More like this? m1=-3000; m2 = 5800;%strength R = 0:0.1:20; THETA = linspace(0,2*pi,numel(R)); [r,theta] = meshgrid(R,THET...

1 jour ago | 0

| accepted

Answered
Find the intersection between two curves
Look at the fzero function (doc fzero). Express y1-y2 as a function and use fzero.

2 jours ago | 1

Answered
equation system with time and space derivation
You could use the pdepe function (try doc pdepe). Alternatively, explicitly discretise z and use ode45 to solve the time depend...

2 jours ago | 0

| accepted

Answered
how to stop executing while loop?
Use a condition inside the while loop, such as if x>10, break, end

2 jours ago | 0

Answered
How to solve an ODE with 2 initial conditions and 2 unknown parameters and 3 boundary conditions (overdetermined?)
The following is as close as I can get. You might be able to do better by altering tolerances using setoptions, but I'll leave ...

2 jours ago | 0

| accepted

Answered
Can anybody help me?
Change Pprime(i) = P.*(lambda) to Pprime(i) = P.*(lambda(i));

2 jours ago | 0

Answered
Approximating /transforming /absolute error
For display purposes you can use fprintf: >> r=3;h=8;Dv=0.1; Dr=(Dv/3)*(1/(1/3*pi*h*2*r)); fprintf('%0.2g \n',Dr) 0.00066

3 jours ago | 1

| accepted

Answered
Finding roots using Newton raphson method
Just get rid of the first line, you don't need it f=@(y) exp(y)-(sin(pi*y/3)); df=@(y) exp(y)-((pi*cos(pi*y/3))/3); x(1)=-3...

3 jours ago | 1

| accepted

Answered
How to solve multivariable ODE
If you don't have the symbolic toolbox available you could just do something like the following % Define gradient function wher...

3 jours ago | 0

Answered
How can I plot this second-order differential equation
More like this perhaps omega = 0.8:0.1:1.5; n = numel(omega); for i = 1:n dydt = @(t,y) [y(2); -0.2*y(2) + y(1) - y(1)...

3 jours ago | 0

Answered
How can I use a string in legend()?
You could use Legend = ['HS+HG = 0.5+5' ;'HS+HG = 1+5']; legend(Legend) But make sure there are the same number of characte...

4 jours ago | 0

Answered
Inverse hyperbolic fit to data
Here's an alternative, with V as the independent variable and P as the dependent one: % Data P = [5 7.5 10 12.5 15 17.5 20 25...

4 jours ago | 2

Answered
make a function recursive (koch snowflake)
The following replaces the "for iteration = 1:n" loop with a recursive function %Koch draws Koch snowflake %n is how many iter...

5 jours ago | 0

| accepted

Answered
What is wrong with my code?
Your code works if you put in sensible numbers for step size and velocity. Zero is not sensible!

5 jours ago | 0

Answered
How can I solve it: Matrix dimensions must agree.
Replace if M ==[] with if isempty(M)

5 jours ago | 0

| accepted

Answered
Getting a wrong answer using solve()
Running your code as is (I copied and pasted, with no changes), I get >> syms pa p1a; c=1.056; Eq1= -8 * p1a ^ 2 + (12 * c -...

5 jours ago | 1

Answered
Best fit line on Semi log graph
Like so data=[0.891 35784.525582 0.91 39142.72 0.815 17679.26 0.891 25582 0.8861 30168.052]; ...

5 jours ago | 1

| accepted

Answered
How to Plot a Fourier Series?
Here's the cosine version. You can add the sin version and play with different ranges for n: x = -24:0.1:24; n = 10; ycos = f...

6 jours ago | 0

| accepted

Answered
How to plot an implicit and dicontinues function?
Do you mean like this (type doc contour for more detail): x1 = -2:0.01:2; x2 = -2:0.01:2; [x, y] = meshgrid(x1, x2); z = T...

6 jours ago | 0

| accepted

Answered
Multiple roots formula with Matlab
I think your formula shoud be First define your function and its first two derivatives in Matlab f = @(x) x.^4- 6*x.^3 + 12*...

6 jours ago | 0

| accepted

Answered
How to plot an implicit and dicontinues function?
Something like the following? (You could use surfc if you want contours as well): x1 = -10:10; x2 = -10:10; [x, y] = meshgr...

6 jours ago | 0

Answered
plotting the graph, help me~~
You had a few mismatches between vgs and Vgs. Matlab is case sensitive. Try W=40; Vth=0.45; Leff=0.15; k=4.255*(10^-4)*(W/L...

6 jours ago | 0

| accepted

Answered
Recursive Function in Matlab (Help)
The Newton_Raphson is a recurrence formula, not a recursive one, so what you have written is correct. Look at the last value o...

6 jours ago | 0

Answered
NUMERICAL INTEGRATION USING SIMPSONS
The problem is that you have many values of lambda. To deal with this use a loop to do the integration for each value of lambda...

6 jours ago | 0

| accepted

Answered
non linear implicit equation
Surprisingly, this has an explicit solution for y (I didn't use Matlab to get it as I don't have the symbolic toolbox to hand) ....

7 jours ago | 1

| accepted

Answered
How to write the codes for this gamma function?
Compare your coded value of 154056.7 with the equation's value of 154.056.

7 jours ago | 0

Answered
Poisson Boltzmann eq. with an infinite boundary condition
I suspect the initial gradient required to get zero at infinity is an irrational number (or possibly a rational number with a la...

7 jours ago | 0

| accepted

Answered
How to solve s system of coupled nonlinear ODES already given the state vector
You need to solve for all xdots simultaneously - this is done in matrix format below. There were also a number of errors in you...

7 jours ago | 1

| accepted

Answered
How to round UP to 1 decimal value?
ceil(x*10)/10

7 jours ago | 0

| accepted

Answered
Generate and Plot N Points Picking Random Points on Triangle
More like the following; rng('shuffle'); n = 1000; % Set number of points as desired % Let (0,0) be vertex 1, (0,2) be verte...

8 jours ago | 0

| accepted

Load more