Community Profile

photo

Alan Stevens


Last seen: Today
754 2020 年以降の合計貢献数

Alan Stevens's バッジ

  • Guiding Light
  • 6 Month Streak
  • Knowledgeable Level 4
  • First Answer

詳細を表示...

貢献した分野
表示方法

回答済み
How can I solve this ode problem?
You get a singularity (divide by zero) when u = 60, giving infinite acceleration. You need to include a guard against this.

22分 前 | 0

回答済み
My function f(x) doesn't display (compute?) the result for when f = 0.
Replace diff(g) by gradient(g)

2日 前 | 0

回答済み
Taking a descend interval
Insert tau = n+1-t; then raise 1/800 to the power tau.

2日 前 | 0

| 採用済み

回答済み
Complex Sinwave to plot
Like this x = 0:0.1:4.56; p = zeros(1,numel(x)); q = zeros(1,numel(x)); for i = 1:numel(x) p(i) = fn(x(i)); q(i) =...

3日 前 | 0

回答済み
Extreme difference between the value of a function and the result in matlab
Must hit an overflow. Express it as: a=sqrt(4950000001); b=30000; r = (a/b)^2; y1 = 333.75+r*(11*r - b^2 -121 - 2/b^4)+5.5*...

3日 前 | 1

回答済み
How to calculate the projection of point onto a line
Try doc std

4日 前 | 0

回答済み
Unable to perform assignment because the left and right sides have a different number of elements
Like this? % 1. Define Initial Conditions N = 50; % x_0 = 50*pi/180*randn(2,N); phi_0 = x_0(1,:...

5日 前 | 0

| 採用済み

回答済み
euler method for solving system of ODE's 1st order
Simple Euler inaccurate for large step size. Reduce step size as in following and see if you get the output you expect: a=0; %...

7日 前 | 1

回答済み
How to stop ODE(R4K) function when the value is close to 0?
Have you tried replacing u_p(i+1)=u_p(i)+h/6*(k1u_p+ 2*k2u_p + 2*k3u_p +k4u_p); with u_p(i+1)= max(u_p(i)+h/6*(k1u_p+ 2*k2u_p...

8日 前 | 0

回答済み
how can i solve this problem and plotting?
I assume you want to find the values of a that make the integral = 75, for all values of x. if so, then the following should do...

8日 前 | 1

| 採用済み

回答済み
speeding up my for loop
Is this any quicker? function y = divisors1(N) i = 1:floor(N/2); L = lcm(N,i); y = sum(L==N) + 1; e...

8日 前 | 0

回答済み
Mark the knee point on a graph
Calculate a vector of values of P = V.*I then choose the maximum. Something like: P = V.*I; indx = find(P==max(P)); Vp = V(in...

9日 前 | 0

| 採用済み

回答済み
Discretising a size distribution function and area under the curve
You should have log(sigma)^2, not log(sigma^2). Don't forget the "dx" part when integrating the curve. mu = 0.015; % geometri...

9日 前 | 1

回答済み
ODE system initial condition results in infinity/NaN error. Initial conditions cannot be changed. How to evade?
Simply write your differential function as: fu_p = @(D_p,u_p) -18*muG*u_p/(rhoP*D_p^2) + g*(rhoP-rhoG)/rhoP; avoiding any expl...

10日 前 | 0

| 採用済み

回答済み
Single bubble expansion equation
Try starting your bubble radius as 2*sigma/1.4, rather than 0.

11日 前 | 0

| 採用済み

回答済み
Coupled rate ODEs with ode45
It can all be done in one script as follows. Because of the orders of magntude difference between the various concentrations th...

11日 前 | 0

回答済み
How can I call the highest order solution (e.g. x'') of an ode in another ode?
You can rearrange the equations as follows to get a consistent set: (you will need to use explicit multiplication where my eq...

11日 前 | 0

| 採用済み

回答済み
How can I make a loop that gives values in each iteration?
Why do you need a loop? There is just one zero between 2 and 8. Your values of w are not used in any meaningful way (they woul...

11日 前 | 0

回答済み
How to use ODE 45 to generate a SIR model
Like so: alpha=1.99; beta=1; gamma=1/7; S=0.99; I=0.01; R=0.1; %tstart=0; %tend=100; y=[S,I,R]; tspan=0:1:100; [t,sol...

12日 前 | 2

回答済み
error in using the function fsolve to find steady state
Using the Optimization toolbox to solve these equations seems like using a sledgehammer to crack a nut! It is clear from the eq...

12日 前 | 0

回答済み
I am trying to solve ODE having more than 1 dependent variable. but I am not able to solve it with dsolve function. please help me to find correct function to solve ODE.This is an mechanical engineering equation so it is bit complicated and lengthy
Here's a possible way using ode45. I've used arbitrary initial values for the three temperatures, so you will need to replace t...

12日 前 | 1

| 採用済み

回答済み
MATLAB Newton Raphson Method with a function with array/matrix variables
You could do it like this f = @(x,g) g.*exp(x) - 1; df = @(x,g) g.*exp(x); g = [1 2 3 4 5]; for i= 1:numel(g) x0 = 0...

12日 前 | 1

| 採用済み

回答済み
When i try to create function error "Unable to perform assignment because the left and right sides have a different number of elements." comes up
Try n=-25:25; x3=zeros(1,length(n)); x3(n>=2 & n<=22)=exp(j*(0.5)).^(2:22);

12日 前 | 0

| 採用済み

回答済み
Explicit Eulers Method for time advancement
T(i)^(n+1) This will raise T(i) to the (n+1)th power! You need another loop for time (say j = 1:something), then you can refer...

13日 前 | 0

回答済み
Hot to fit two curves under interdependent constraint ?
How about just using fminsearch x = linspace(1,100,100); % Measurement results: y1=[0.07469056,0.07378624,0.07288704,0.071992...

13日 前 | 0

| 採用済み

回答済み
Need assistance using bisection method to find equation roots in Matlab function.
Try this % input for function that we're finding the roots of f1 = @(x) ((-0.6)*x^2)+(2.4*x)+(5.5); xl = 5; % xl sets the i...

13日 前 | 0

| 採用済み

回答済み
Errors in Newton Raphson Code
Again, more like this % f = 3*exp(x)-4*cos(x) % df/dx = 3*exp(x)+4*sin(x) i=1; x=0.1; err = 1; while err>10^-8 && i<100 ...

13日 前 | 0

回答済み
Error in Newton-Raphson Method
Like this R=15/2; v=500; h=8; i=1; err = 1; while err>10^-8 && i<100 hold = h; fh = pi*h^2*(3*R - h)/3 - v; ...

13日 前 | 0

回答済み
Plotting partial sums of series
Do you mean something like this? x = -pi:0.1:pi ; %initializing x S = zeros(20,numel(x)); figure xlim([1 20]) grid hold o...

13日 前 | 0

| 採用済み

回答済み
Anonymous function surface plot
Are you looking for something like this? n = 2; x_opt = randi([-6,6],n,1); A = randi(n,n); T = A*A' + eye(n,n); h = -T*x_op...

14日 前 | 1

| 採用済み

Load more