Beantwortet
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')

mehr als 5 Jahre vor | 0

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

mehr als 5 Jahre vor | 0

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

mehr als 5 Jahre vor | 0

| akzeptiert

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

mehr als 5 Jahre vor | 0

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

mehr als 5 Jahre vor | 0

| akzeptiert

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

mehr als 5 Jahre vor | 0

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

mehr als 5 Jahre vor | 0

| akzeptiert

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

mehr als 5 Jahre vor | 1

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

mehr als 5 Jahre vor | 0

| akzeptiert

Beantwortet
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

mehr als 5 Jahre vor | 0

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

mehr als 5 Jahre vor | 0

| akzeptiert

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

mehr als 5 Jahre vor | 1

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

mehr als 5 Jahre vor | 0

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

mehr als 5 Jahre vor | 1

| akzeptiert

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

mehr als 5 Jahre vor | 0

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

mehr als 5 Jahre vor | 0

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

mehr als 5 Jahre vor | 1

| akzeptiert

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

fast 6 Jahre vor | 0

| akzeptiert

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

fast 6 Jahre vor | 0

| akzeptiert

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

fast 6 Jahre vor | 0

Beantwortet
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))./((...

fast 6 Jahre vor | 0

Beantwortet
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!): ...

fast 6 Jahre vor | 0

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

fast 6 Jahre vor | 0

| akzeptiert

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

fast 6 Jahre vor | 0

| akzeptiert

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

fast 6 Jahre vor | 2

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

fast 6 Jahre vor | 1

| akzeptiert

Beantwortet
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

fast 6 Jahre vor | 0

| akzeptiert

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

fast 6 Jahre vor | 0

| akzeptiert

Beantwortet
bessel function derivatives problem
Like so:

fast 6 Jahre vor | 0

| akzeptiert

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

fast 6 Jahre vor | 0

Mehr laden