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

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

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

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

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

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

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

5 years ago | 0

| accepted

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

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

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

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

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

5 years ago | 0

Answered
First Order Differential Equation
Try plot(t, Y(3:6,:))

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

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

5 years ago | 0

Answered
How to round number up to a specific number of decimal places?
ceil(10*x)/10

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

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

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

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

5 years ago | 0

Answered
Having difficulty getting the program right
Make h and v functions of time. For example; h = @(t) (0.5)*(g)*t.^2+(v0)*(t)+h0; Also, make sure you use a different symbol ...

5 years ago | 0

Answered
Advection-dominant 1D advection-diffusion equation
I think a step change in A0 is just too severe for the numerics to handle correctly once it gets to a certain size. Instead of ...

5 years ago | 0

| accepted

Answered
Number of peaks per interval
How about: newtime = 1:max(time); newpeakcount(time) = peakcount;

5 years ago | 1

Answered
Using Surf function with matrix
What about simply: surf(C)

5 years ago | 0

Answered
ode45 returning Nan values
Have you basically got the wrong sign in dydt(2)? tspan = 60*[1 300000]; y0 = [1 333.15]; [t, y] = ode45(@myODE, tspan, y0); ...

5 years ago | 0

Answered
Resolve normal depth from Manning's equation
This shoud do it: depth0 = 1; % Initial guess depth = fzero(@manningfn, depth0); function manning = manningfn(y) rive...

5 years ago | 0

| accepted

Answered
Help me please Plotting values using Secant method
Increase tf from 3 to 4 to get all the lines returning to zero.

5 years ago | 1

| accepted

Answered
How do I model thermal contact resistance using the Matlab partial differential toolbox?
Can you put a thin layer between the two materials and use an effective conductivity? Something like: keff = deltax/R where R i...

5 years ago | 0

Answered
How to solve differential equation of damped spring mass system under impulsive external force using ode45?
Something like this: tspan = 0:0.000002:0.002; tlo = tspan(100); thi = tspan(115); [t,y4] = ode45(@fun,tspan,[0 0],[],tlo,t...

5 years ago | 0

| accepted

Answered
How to I put a tilde/bar/hat on a word (2 characters) in my figure legend?
Use \widetilde rather than just \tilde

5 years ago | 2

Load more