Réponse apportée
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')

plus de 5 ans il y a | 0

Réponse apportée
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;...

plus de 5 ans il y a | 0

Réponse apportée
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...

plus de 5 ans il y a | 0

| A accepté

Réponse apportée
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 ...

plus de 5 ans il y a | 0

Réponse apportée
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.

plus de 5 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 5 ans il y a | 0

Réponse apportée
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...

plus de 5 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 5 ans il y a | 1

Réponse apportée
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...

plus de 5 ans il y a | 0

| A accepté

Réponse apportée
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

plus de 5 ans il y a | 0

Réponse apportée
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...

plus de 5 ans il y a | 0

| A accepté

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

plus de 5 ans il y a | 1

Réponse apportée
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...

plus de 5 ans il y a | 0

Réponse apportée
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...

plus de 5 ans il y a | 1

| A accepté

Réponse apportée
Solving non linear equation
Use cosd instead of cos. cosd assumes the argument is in degrees, cos assumes the argument is in radians.

plus de 5 ans il y a | 0

Réponse apportée
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, ...

plus de 5 ans il y a | 0

Réponse apportée
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...

plus de 5 ans il y a | 1

| A accepté

Réponse apportée
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...

plus de 5 ans il y a | 0

| A accepté

Réponse apportée
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 ...

plus de 5 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 5 ans il y a | 0

Réponse apportée
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))./((...

plus de 5 ans il y a | 0

Réponse apportée
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!): ...

plus de 5 ans il y a | 0

Réponse apportée
How to solve an equation using numerical solver in Matlab?
Look up documentation on fzero.

plus de 5 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 5 ans il y a | 0

| A accepté

Réponse apportée
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) ...

plus de 5 ans il y a | 2

Réponse apportée
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; ...

plus de 5 ans il y a | 1

| A accepté

Réponse apportée
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

plus de 5 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 5 ans il y a | 0

| A accepté

Réponse apportée
bessel function derivatives problem
Like so:

plus de 5 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 5 ans il y a | 0

Charger plus