Answered

x-intersection of part of extended line from curve

You can use the following relation: ( max(y_redline_value) - min(y_redline_value) ) / ( max(x_redline_value) - min(x_redl...

x-intersection of part of extended line from curve

You can use the following relation: ( max(y_redline_value) - min(y_redline_value) ) / ( max(x_redline_value) - min(x_redl...

9 hours ago | 0

Answered

Using 'for' loop in integral correctly

Just define y as a function of t, B, a, b, and c, wihout regard to i. Then call the function with the appropriate parameters wh...

Using 'for' loop in integral correctly

Just define y as a function of t, B, a, b, and c, wihout regard to i. Then call the function with the appropriate parameters wh...

14 hours ago | 0

Answered

Error with surf function

Try x = linspace(1,16,16); y = linspace(1,256,256); surf(x,y,data)

Error with surf function

Try x = linspace(1,16,16); y = linspace(1,256,256); surf(x,y,data)

1 day ago | 1

Answered

Solving second order non-linear equations (time-domain)

Here's the basic idea. First turn your second-order ODE into twofirst order ones, like so: Then structure your code along th...

Solving second order non-linear equations (time-domain)

Here's the basic idea. First turn your second-order ODE into twofirst order ones, like so: Then structure your code along th...

2 days ago | 0

| accepted

Answered

Maximization function using linear programming

It's clear that the maximum of G will occur when D = 0.50 and eff = 0.75. Do a surf plot to convince yourself!

Maximization function using linear programming

It's clear that the maximum of G will occur when D = 0.50 and eff = 0.75. Do a surf plot to convince yourself!

3 days ago | 0

Answered

ODE Inverse Laplace Transformation Constants Error

The solution you think is correct does not satisfy the condition y`(0) = 0. It gives y`(0) = 9. MATLAB's solution satisfies bo...

ODE Inverse Laplace Transformation Constants Error

The solution you think is correct does not satisfy the condition y`(0) = 0. It gives y`(0) = 9. MATLAB's solution satisfies bo...

3 days ago | 0

Answered

Bisection method for transcendental equations. I:e tan(x)= x

If I were you I would change the "while" condition to while abs(x1-x2) > 0.0001

Bisection method for transcendental equations. I:e tan(x)= x

If I were you I would change the "while" condition to while abs(x1-x2) > 0.0001

3 days ago | 0

Answered

How to find the angle in MatLab

atan(200/20) works perfectly well in Matlab. Note that the result is in radians. If you want the angle in degrees then multipl...

How to find the angle in MatLab

atan(200/20) works perfectly well in Matlab. Note that the result is in radians. If you want the angle in degrees then multipl...

4 days ago | 0

| accepted

Answered

ode45 does not solve my second order problem

Your warnings occur when z(1) goes negative. They can be eliminated by including if z(1)<0 z(1) = 0; end at the beginn...

ode45 does not solve my second order problem

Your warnings occur when z(1) goes negative. They can be eliminated by including if z(1)<0 z(1) = 0; end at the beginn...

4 days ago | 1

| accepted

Answered

Comapring Values in one Matrix to another

What about: A = [373 383 393 403 413 420 451 485 499] ; B = [373 453 457 461 464]; k = 1; for i = 1:length(A) t = A(i); ...

Comapring Values in one Matrix to another

What about: A = [373 383 393 403 413 420 451 485 499] ; B = [373 453 457 461 464]; k = 1; for i = 1:length(A) t = A(i); ...

4 days ago | 0

Answered

Plotting a function with vectors that show propagation of function.

Does this do what you want: X = linspace(-150,150,200); g2 = 5; g3 = 0.5; sigma0 = 0.05; B = -(3*g2*sigma0-8*g3*sigma0)...

Plotting a function with vectors that show propagation of function.

Does this do what you want: X = linspace(-150,150,200); g2 = 5; g3 = 0.5; sigma0 = 0.05; B = -(3*g2*sigma0-8*g3*sigma0)...

4 days ago | 0

Answered

Plotting a contour plot for a variable dependednt on the while loop

I'm not sure if I've interpreted your requirements correctly, but what about the following: %% Inputs IR = 1e-3; %initial ra...

Plotting a contour plot for a variable dependednt on the while loop

I'm not sure if I've interpreted your requirements correctly, but what about the following: %% Inputs IR = 1e-3; %initial ra...

4 days ago | 0

| accepted

Answered

Plotting a contour plot for a variable dependednt on the while loop

Your code doesn't stop because Vol never reaches zero. What does the c index do for you? Your contour function won't plot wh...

Plotting a contour plot for a variable dependednt on the while loop

Your code doesn't stop because Vol never reaches zero. What does the c index do for you? Your contour function won't plot wh...

5 days ago | 0

Answered

How can i find the minimum value of spline data

Change your last two lines to: s=spline(x,y); min(ppval(s,x)) (though it's fairly clear that the minimum occurs at x = 0!)

How can i find the minimum value of spline data

Change your last two lines to: s=spline(x,y); min(ppval(s,x)) (though it's fairly clear that the minimum occurs at x = 0!)

5 days ago | 0

| accepted

Answered

To repeat calculation in a matrix

Do you mean you want the maximum of the rows in RAJ_Mx1 taking into consideration only those values where the corresponding ele...

To repeat calculation in a matrix

Do you mean you want the maximum of the rows in RAJ_Mx1 taking into consideration only those values where the corresponding ele...

5 days ago | 0

| accepted

Answered

help in plot of sin

Try t=0:1/(f*50):1/(f*0.5); instead of t=0:1/(f*5):1/(f*0.5);

help in plot of sin

Try t=0:1/(f*50):1/(f*0.5); instead of t=0:1/(f*5):1/(f*0.5);

5 days ago | 0

Answered

How do I plot a univariate integral?

Like this (you will need to replace my arbitrary polynomial with your own): % Arbitrary polynomial p = [2 1 -1 3 1 -1 5]; fun...

How do I plot a univariate integral?

Like this (you will need to replace my arbitrary polynomial with your own): % Arbitrary polynomial p = [2 1 -1 3 1 -1 5]; fun...

5 days ago | 0

Answered

How to convert a char into double?

Unfortunately, sscanf only gets the first 1863 numbers for some reason. The following gets them all: f = '92 -707 1349 92 -708...

How to convert a char into double?

Unfortunately, sscanf only gets the first 1863 numbers for some reason. The following gets them all: f = '92 -707 1349 92 -708...

5 days ago | 0

Answered

Newton Raphson’s method

If we set f(x) = cos(x) + 2sin(x) + x^2, then the question is asking for the value of x that makes f(x) = 0. Newton-Raphson is ...

Newton Raphson’s method

If we set f(x) = cos(x) + 2sin(x) + x^2, then the question is asking for the value of x that makes f(x) = 0. Newton-Raphson is ...

6 days ago | 0

Answered

Calculate the distance between a linear regression line and the data points

If you have the x-values of all the data points of interest you can calculate the corresponding y-values of your line simply us...

Calculate the distance between a linear regression line and the data points

If you have the x-values of all the data points of interest you can calculate the corresponding y-values of your line simply us...

7 days ago | 0

| accepted

Answered

fminbnd got stock in local minimum: can global search deal with the problem defined by cases?

Narrow the allowed search interval. If you've plotted the function you should be able to get a good idea of where the global mi...

fminbnd got stock in local minimum: can global search deal with the problem defined by cases?

Narrow the allowed search interval. If you've plotted the function you should be able to get a good idea of where the global mi...

7 days ago | 0

| accepted

Answered

How do I plot filled markers on top of two axis

Try changing the order: X = linspace(1,10,20); % Create axes ax1=gca; ax2=axes('Position',get(ax1,'Position'),'YAxisLocati...

How do I plot filled markers on top of two axis

Try changing the order: X = linspace(1,10,20); % Create axes ax1=gca; ax2=axes('Position',get(ax1,'Position'),'YAxisLocati...

7 days ago | 0

Answered

First Order Differential Equation

Well, the following shows how to progress through time. However, the explicit form you've adopted is unstable. I've included a...

First Order Differential Equation

Well, the following shows how to progress through time. However, the explicit form you've adopted is unstable. I've included a...

8 days ago | 0

| accepted

Answered

ode,dsolve,spline,ode interp, differantial

More like this perhaps: xspan = [0 3]; Q0 = 0; [x, Q] = ode45(@f, xspan, Q0); plot(x,Q), grid xlabel('x'), ylabel('Q'...

ode,dsolve,spline,ode interp, differantial

More like this perhaps: xspan = [0 3]; Q0 = 0; [x, Q] = ode45(@f, xspan, Q0); plot(x,Q), grid xlabel('x'), ylabel('Q'...

9 days ago | 0

Answered

How to round number up to a specific number of decimal places?

ceil(10*x)/10

How to round number up to a specific number of decimal places?

ceil(10*x)/10

9 days ago | 0

| accepted

Answered

Vector dimensions in my ode

I think the following produces somewhat more sensible results. I was confused for some time because you use x for both distance...

Vector dimensions in my ode

I think the following produces somewhat more sensible results. I was confused for some time because you use x for both distance...

9 days ago | 0

| accepted

Answered

Vector dimensions in my ode

The problem is here: f = @(t,x) [ x(2); -( k_s*(x(1)-h)/ m ) ]; When you call this function, x(2) is a single value, but since...

Vector dimensions in my ode

The problem is here: f = @(t,x) [ x(2); -( k_s*(x(1)-h)/ m ) ]; When you call this function, x(2) is a single value, but since...

10 days ago | 0

Answered

help solving differential equations

I think the following does all that you want. My implementation of the legend is cumbersome, but works! % m*f'^2 -0.5(m+1)*f*f...

help solving differential equations

I think the following does all that you want. My implementation of the legend is cumbersome, but works! % m*f'^2 -0.5(m+1)*f*f...

10 days ago | 0

Answered

Please help me convert equation to matlab code.

This does what you seemed to be trying to do:: pgridbuy = [3.3, 3.5, 3.2, 3.1, 3.6]; pgridsold = [2.3, 2.6, 3.1, 4.1, 4.4]; p...

Please help me convert equation to matlab code.

This does what you seemed to be trying to do:: pgridbuy = [3.3, 3.5, 3.2, 3.1, 3.6]; pgridsold = [2.3, 2.6, 3.1, 4.1, 4.4]; p...

10 days ago | 0