Respondida
First value of an array does not display with a decimal
If you like it more, you can use sprintf('%f %f %f',[x, y, z]) instead of disp([x y z]);

11 meses hace | 1

Respondida
How to integrate a control system by ode45 with PID control input ?
Add a second differential equation dV/dt = P.Xd - X with initial condition V(0) = 0 Then V(t) = integral_{0}^{t} (P.Xd -...

11 meses hace | 0

Respondida
Matlab's polyfit gives different results when the independent variable is integer than when the independent variable is floating point. Why is that so?
To be consistent, you must either use numDataPointsMinutes = [0,1,2,3, ... 27359]; instead of numDataPointsMinutes = [1,2,3, ...

11 meses hace | 0

| aceptada

Respondida
How to remove the time dependence of an equation?
Use fimplicit(eq_14(t)==0,"r","LineWidth",2) instead of fimplicit(eq_14==0,"r","LineWidth",2) Why do you use a time-dependen...

11 meses hace | 0

| aceptada

Respondida
Seeking advice from experts
Use one of the below codes instead. You can't nest functions within a script, but only within another function. So either defi...

11 meses hace | 0

Respondida
Newtonian Mechanics vector solution needed to find the range of forces (P) that satisfy Fnetx = 0
Your search will never find a value for P for which Fnetx is exactly 0. Better use "fsolve" to solve for the corresponding roo...

12 meses hace | 0

| aceptada

Respondida
can anyone help me. I am getting error of the following problem
Let's ignore the fifth differential equation in your code for a moment. Then you set up code for the differential equation y''...

12 meses hace | 1

| aceptada

Respondida
Monitoring Variables Defined Within Functions to Debug
After the variable is computed, you can list the variable's name by itself on it's own line in your function code, with no semic...

12 meses hace | 0

| aceptada

Respondida
ddesd giving NaN for all state variables beyond time step 1.
The history function has to cover values for t that are negative (because y6 becomes large and you have to supply y1(t-y6)). But...

12 meses hace | 0

| aceptada

Respondida
Extracting coefficients from symbolic expression
syms P121 P131 P151 P122 P132 P152 cosdphi12over2 cosdphi13over2 cosdphi15over2 sindphi12over2 sindphi13over2 sindphi15over2 P12...

12 meses hace | 1

Respondida
Iterative of Nonlinear Functions
Why do you use "solve" to get t1,...,t15 ? You can directly solve for the unknowns because you use the explicit Euler method to ...

12 meses hace | 0

Respondida
Possible bug in coneprog.m function
This works for dense matrices/vectors, but in sparse mode, it gives exitflag = -7 as above. Maybe it's worth asking MATLAB suppo...

12 meses hace | 1

| aceptada

Respondida
How can we plot the same time history plot two times but the second time with a time delay of 2 sec?
You mean t = 0:0.1:20; p = t.^2; hold on plot(t,p,'b') plot(t+2,p,'r') hold off grid on ?

12 meses hace | 0

| aceptada

Respondida
plotting 2 figures in same for loop
figure hax1=axes; hold(hax1,'on') figure hax2=axes; hold(hax2,'on') x=1:5; for i=1:6 if rem(i,2)==0 scatter...

12 meses hace | 0

| aceptada

Respondida
Solving differential equations with state variables and co-states
This code works, but gives no solution for the parameters given. %% Title: Solving Hamiltonian Objective Function using system ...

alrededor de 1 año hace | 1

| aceptada

Respondida
Finding if the current data value is greater than the previous value
It would help if you include the GDF-file. Without further information, I'd suggest T = readtable ("GDF.xlsx"); A = table2arr...

alrededor de 1 año hace | 2

| aceptada

Respondida
How to multiply different size arrays and multiply each element by each element?
If nothing helps, make a 4-fold nested loop. for i=1:numel(Span) for j = 1:numel(MAC) for k = 1:numel(CoM) ...

alrededor de 1 año hace | 0

Respondida
Combine non integer time steps into daily values
@Cristóbal Looking at the volume values, I'm almost sure that these values are already cumulative values. Why should the increa...

alrededor de 1 año hace | 2

Respondida
Programming wave dispersion equation
Code taken from https://uk.mathworks.com/matlabcentral/fileexchange/156009-wavelength-calculation-based-on-dispersion-relations...

alrededor de 1 año hace | 0

| aceptada

Respondida
Modelling a system of differential equations with recurrences in matlab
N = 20; k = 1; a = 1; b = 1; c = 1; d = 1; u0 = zeros(N,1); udot0 = 0.5*ones(N,1); v0 = zeros(N,1); vdot0 = 0...

alrededor de 1 año hace | 0

| aceptada

Respondida
How can received my license?
Either through the IT department of your university or - if you have an individual licence - by contacting MATLAB support: http...

alrededor de 1 año hace | 1

Respondida
Please help me to solve this simple error
@Walter Roberson answered the question about your MATLAB error. Concerning the problem you try to solve: I assume d1, d2 are ...

alrededor de 1 año hace | 0

Respondida
Curve fitting with a custom equation
Only round brackets are allowed in your expression. But maybe there are additional problems. If the code does not work after r...

alrededor de 1 año hace | 0

Respondida
Trying to figure out a algorithm to filter out some data, since I dont have any additional toolbox.
load("eeandv.mat") tol = 0.005; idx = abs(diff(e)) <= tol; e = e(idx); v = v(idx); plot(v,e) grid on; grid minor; xlim([...

alrededor de 1 año hace | 1

Respondida
I want to avoid fractions in my answer to the null space
Insert for i = 1:size(N_A,2) [~,d] = numden(N_A(:,i)); N_A(:,i) = N_A(:,i)*lcm(d); end after computing N_A.

alrededor de 1 año hace | 0

Respondida
Prevent "any Matlab service" from loading on Windows 11 startup.
Follow the instructions given here: https://uk.mathworks.com/matlabcentral/answers/101038-why-is-matlab-always-running-in-the-b...

alrededor de 1 año hace | 0

Respondida
why does set(gca) not working
The set command must be placed after the plot command, not before: FONT_SIZE = 16; max_iter = 10; x = 1:max_iter; % this is t...

alrededor de 1 año hace | 0

| aceptada

Respondida
Naming Table Variables of a File
load("T.mat") T1 = splitvars(T); T1 = renamevars(T1,["rows_1" "rows_2" "rows_3" "rows_4" "rows_5" "rows_6"],... ...

alrededor de 1 año hace | 1

| aceptada

Respondida
Error using countOnes = sum(num); when trying to count how many zeros and ones are randomly generated.
Works in R2025A (see above). I suspect that somewhere in your code, you define a variable with name "sum". Rename it because it...

alrededor de 1 año hace | 1

Respondida
Please i need to plot 3 dimension figure with (x axis is x, y axis is gamma function) and z axis is value of u for this simple attached relation
We don't know your problem, but it should work somehow like this. What do you mean by "the y-axis is the gamma function" ? Do ...

alrededor de 1 año hace | 0

Cargar más