Respondida
creatting a polygon in matlab
You could also use the patch function x = [0 0:30 30 0]; y = [0 10+exp((-(x(2:end-2)-15).^2)/10) 0 0]; patch(x,y,'r')

casi 6 años hace | 0

Respondida
Why solution vector of system of linear equations on MATLAB differs from that on EXCEL
Matlab is dependable! Haven't tried in Excel, but the Matlab results are consistent: A=0.012271846; m1=2; m2=2; m3=0.5; m4=0.5;...

casi 6 años hace | 0

Respondida
How to maintain uniformity in the xtick and ytick labels? Also, how to adjust the legend position in a non-interactive setup.
I'm not sure what you mean by the y-tick spacing being different from that of the x-ticks. I've let the fonts retain their defa...

casi 6 años hace | 0

| aceptada

Respondida
How can I solve non-linear differential equations?
Here's how you might structure your code. Clearly, you will need to use your own constants and initial conditions etc. tspan ...

casi 6 años hace | 0

Respondida
how can i make matrix 1 1/2 1/3 1/4 ... 1/n
This is built in to Matlab. Try help hilb in the workspace.

casi 6 años hace | 0

| aceptada

Respondida
How to make a UDF that calculates the Midpoint Rule
Don't confuse x with t! The following might help. I'll leave you to turn it into a function: f = @(x,y) x+y; % function of t...

casi 6 años hace | 0

Respondida
Regarding Index in position 1 exceeds array bounds (must not exceed 1) error
You have defined LB and UB as 1x2 vectors, but in the line giving an error you are trying to access elements i, j where i can b...

casi 6 años hace | 0

| aceptada

Respondida
Why does the array only work once?
You need element by element multiplication and division: % Givens AB = 150; BD = 200; Theta = 20:120; Mb = 2.5; %Solutio...

casi 6 años hace | 1

Respondida
Array indices must be positive integers or logical values
The following works x = [0.888: 0.01: 1.178]; %x values for n = 1: 1: length(x) %must have different vector because varia...

casi 6 años hace | 0

| aceptada

Respondida
Getting error in the Q(1) = IC, how do i apply Forward Euler to this
See my last reply here: https://uk.mathworks.com/matlabcentral/answers/601966-morse-potential-solve-using-matlab

casi 6 años hace | 0

Respondida
Problem in simulating if condition
You can replace your if statement with % Assuming there are 100 steps in T nhi=(Nd/2)+(sqrt(((Nd/2)^2)+(ni(51:100).^2))); nlo...

casi 6 años hace | 0

| aceptada

Respondida
How to solve a system of differential equations using ODE45 with a different end conditions?
Look up ODE Event Location in the Matlab documentation.

casi 6 años hace | 1

Respondida
Rolling a Fair 6-Sided Die Until Two Consecutive Rolls Have the Same Value
I think the above will produce a probability, rather than an expected value. Try NTrials = 1000; N = zeros(NTrials,1); for T...

casi 6 años hace | 0

Respondida
Plot two variable sum function
Looks like you are translating from SMath Studio to MATLAB. The following is one way to do what you want: % Basic data beta(1...

casi 6 años hace | 1

| aceptada

Respondida
Solving non linear equation
Use cosd instead of cos. cosd assumes the argument is in degrees, cos assumes the argument is in radians.

casi 6 años hace | 0

Respondida
Varying parameters in ODE and plot the different outcomes
More like this perhaps: timeSpan = [0 50]; % S I1 I2 R S I1 I2 R S I1 I2 R P0 = [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, ...

casi 6 años hace | 0

Respondida
Rules of Reynolds Averaging
uprime doesn't mean du/dt here. It means u - umean. u = [1,3,6,8,24]; umean = mean(u); uprime = u-umean; mean(uprime) an...

casi 6 años hace | 1

| aceptada

Respondida
Dsolve giving implicit solution
Look at documentation on ode45. You don't need a symbolic solution if you just want to get T as a function of t. Like the fol...

casi 6 años hace | 0

| aceptada

Respondida
How to solve this equation Numerically [VPASOLVE]
You can solve it numerically using fzero. Ism=200; Wb=1500; speedend=6000; Ws=Wb:15:speedend; Idn = zeros(size(Ws)); Idn0 ...

casi 6 años hace | 0

| aceptada

Respondida
using solve, 4eqs 4unkns
There are, in fact, an infinite number of possible solutions. When t = 0 the equations can be written and manipulated as follow...

casi 6 años hace | 0

Respondida
Vectorisation of a Lagrange polynomial
In your expression dfdx(j) = f(j-1).*(x(j)+x(j+1))./((x(j-1)+x(j)).*(x(j-1)+x(j+1)))... +f(j).*(2.*x(j)+x(j-1)-x(j+1))./((...

casi 6 años hace | 0

Respondida
how can i plot this code ?
You need to plot them separately as they have completely different 'x' values (indeed the ri values seem unbelievably small!): ...

casi 6 años hace | 0

Respondida
How to solve an equation using numerical solver in Matlab?
Look up documentation on fzero.

casi 6 años hace | 0

| aceptada

Respondida
need check for Bisection Method
When you are close to the solution it won't much matter if you use b-p or b-a. However, you shoud probably use abs((b-p)/(b0-a...

casi 6 años hace | 0

| aceptada

Respondida
fixed point Iterative method for finding root of an equation
I defer to John on the guarantee. Certainly it's possible with x - exp(-x) = 0: % x - exp(-x) = 0; rearrange as x = exp(-x) ...

casi 6 años hace | 2

Respondida
whenever i use individual value of time (Tv) the output function (F) giving right value but using time in the form of loop ,output function gives wrong result for all.How to fix this ?
You missed a set of brackets connecting TV to 273. c1 = 3.742*10.^8; c2 = 1.43878*10.^4; sigma = 5.67*10.^-8; lamda_1 = 8; ...

casi 6 años hace | 1

| aceptada

Respondida
Symsum every other step
Does this help: syms k p a = [1 5]; f=@(k,p) (2*k)^2*p; f1=symsum(f,k,a) f1 = 220*p

casi 6 años hace | 0

| aceptada

Respondida
Morse Potential solve using Matlab
Do you mean like the following (where I've just used 1 atom): If so, then something like the following coding might do: %% S...

casi 6 años hace | 0

| aceptada

Respondida
bessel function derivatives problem
Like so:

casi 6 años hace | 0

| aceptada

Respondida
Density-Temperature diagram
Perhaps you should have T instead of x in the last line (and have you got the two parameters the wrong way round? You want to ge...

casi 6 años hace | 0

Cargar más