Answered
problem with back-substitution code
Define U and b outside function to which you pass them. Define L. %--INPUTS--------------------------------------------------...

5 years ago | 0

| accepted

Answered
Runga Kutta method 4
Firstly, you can't have spaces in the name of the m-file. Remove them. Secondly, remember "length" not "lenght". Thirdly, pas...

5 years ago | 0

| accepted

Answered
How can I get all the legends using this script?
Try something like: legText = []; before your for loop. Then legText = [legText; leg.String{1}]; within the loop, and lege...

5 years ago | 0

Answered
Solving trigonometric equation (decoupling)
How about just defining the function: phi = @(psi, theta) atan( sin(psi).*sin(theta)./(cos(psi) + cos(theta)) );

5 years ago | 0

| accepted

Answered
Significantly different between two nonlinear functions
Or you could linearise by simply inverting and plotting 1/y1 against x1, and 1/y2 against x2.

5 years ago | 0

Answered
How to solve for multiple variables using multiple equations?
Here's a Newton-Raphson routine for the problem: % Newton-Raphson Simultaneous Equations % Six variables N1 to N6 need to be f...

5 years ago | 2

| accepted

Answered
Why I am getting this message for Luo-Rudy Model?
You have a clashing definition for Xi. Once as a constant and once as a function. I suggest you change the function name to, s...

5 years ago | 0

Answered
How do I fix index exceeds the number of array elements (4)
Your last index in points_to_check is 5, but you only have arrays with 4 elements. Change the 5 to 4 and you get rid of the err...

5 years ago | 2

| accepted

Answered
Getting NaN in ode45 for Luo-Rudy model
Your problem occurs when y(8) gets to zero. log(y(8) then becomes complex. You can overcome this by limiting its value as in: ...

5 years ago | 0

Answered
hi, i wanna plot gaussion shape function with any arbitrrary number . how can i plot that?
Define it as a function: f = @(x,a,b,c) a*exp(-(x-b).^2)/(2*c^2); then define your constants a, b and c, specify the range of ...

5 years ago | 0

| accepted

Answered
Question regarding while loop
(1) Because you need a value in the logic test: abs(y^2 - x) > ... (2) Because you need an initial guess on the right-hand side...

5 years ago | 0

| accepted

Answered
Solve ODE via Midpoint rule nonlinear system
You can do it this way: A = 0.01; B = 0.01; dt = 0.01; t = 0:dt:20; x = zeros(size(t)); y = zeros(size(t)); x(1) = 20...

5 years ago | 1

| accepted

Answered
plot curves in matlab
Somethig like this: qafn = @(w) acos(( 4891*w.^4/4480000000 -93*w.^6/560000000000 -603*w.^2/2560000 -105/64 )... ./(9*w.^4...

5 years ago | 0

Answered
creating a new matrix from an obtained matix?
Something like: M = [1 2 3; 4 5 6; 7 8 9]; Mplus = [M zeros(3,1)] Mplus = 1 2 3 0 4 5 6 ...

5 years ago | 0

Answered
Compute the Cross-correlation coefficient out of one Vector
If your data is in a vector V, then the following should do it: coeff = zeros(1,16); for k = 1:16 lag = k-1; v...

5 years ago | 0

| accepted

Answered
How to solve the Beeler Reuter model
You haven't defined functions alpha_f and beta_f (they are called in line 66).

5 years ago | 0

| accepted

Answered
sum some values of a column based on an other column
If data is in M, then C1 = sum(M(M(:,1)==1,2)); C2 = sum(M(M(:,1)==2,2)); C3 = sum(M(M(:,1)==3,2)); is one possibility.

5 years ago | 1

Answered
no plot appearing for loop
You have t = 0 every time you enter the inner loop, and you don't update it. This gives rise to zeros in subsequent lines.

5 years ago | 0

Answered
Non-linear fitting for more than three variables
Because of the form of the desired fit, one can also do a fit by first taking logs. See the coding and result below. (Note Thet...

5 years ago | 0

Answered
Setting up ODE Event Function
Search ODE Event Location in the Matlab documentation to see an example (similar to yours) of how to do it.

5 years ago | 0

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

5 years ago | 1

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

5 years ago | 0

| accepted

Answered
Error with surf function
Try x = linspace(1,16,16); y = linspace(1,256,256); surf(x,y,data)

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

5 years 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!

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

5 years 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

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

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

5 years 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); ...

5 years ago | 0

Load more