已回答
Create a loop with doubling the previous number minus 1
Use a while loop and perform the operation in each iteration - %Starting value x = 2; %Run the loop till the value of x is...

7 months 前 | 1

已回答
How to create a long matrix rapidly
ones does exist, but using eye would be easier and faster here - n = 10; x = 1 - eye(n)

7 months 前 | 1

已回答
Square wave with randomly varying frequency
The increment in time vector too small to clearly resolve the output wave-form. You can either zoom into parts of wave form to ...

7 months 前 | 0

已回答
Meshgrid on inhomogeneous surface plot
To modify the lines on the surface, you will have to modify the underlying data. You might not be able to get the exact shape, ...

7 months 前 | 0

已回答
the size of picture show three data?
It does not result in 3 images. That is a single image only, which is stored as a 3D array. That is a RGB image, also referred...

7 months 前 | 0

已回答
Determining area considering nodes arranged in space in an almost circular shape
Directly use polyarea - load('plane_new.mat') x = plane_new(:,1); y = plane_new(:,2); plot(x,y,'.-r') A = polyarea(x...

7 months 前 | 1

| 已接受

已回答
I need to keep only specific columns from the .csv table
%Read the data tb = readtable('satellites-16-Jan-2024.csv', VariableNamingRule="preserve") %Compare the values from 2nd column...

7 months 前 | 0

| 已接受

已回答
Revert y-axis order in BarPlot
There are multiple ways to do that. One simple way is reverse the Y-axis direction (assuming the data is originally sorted des...

7 months 前 | 0

| 已接受

已回答
Adding and dividing elements in a 3D array
A = rand(15,5,120); B = (A(1:end-1,:,:) + A(2:end,:,:))/2 size(B)

7 months 前 | 1

| 已接受

已回答
How could I fix the parsing error on line 8
The most notable issue I can see is the un-supported character in the 8th line before the fix() call, which appears as a box. R...

7 months 前 | 1

已回答
How change only second number in a=ones(1,10)?
Simply use indexing to change the element - a = ones(1,10); a(2) = 2

7 months 前 | 0

| 已接受

已回答
一つの3次元座標軸内に複数の球面をプロットしたい
They are plotted in 3D, you just need to change the line of sight. Check view for more information. D = [4.8115220,1.5733090,1...

7 months 前 | 0

| 已接受

已回答
What hardware Matlab Online uses?
As MATLAB Online runs on a Linux OS, run this command and see the output - system('lscpu')

7 months 前 | 2

| 已接受

已回答
changing expression to function
You will have to define x and y as symbolic variables first - %Random values for example a = rand(1,10); b = rand(1,10); ...

7 months 前 | 0

已回答
add internal parts of a vector
Here is a simple way of dividing the data into groups of 1 and counting the number of elements for each sub-group - %Converted ...

7 months 前 | 2

| 已接受

已回答
I am not getting a graph for my matlab program but I can run a program . I am attaching my file. can anyone help me with this?
There's no need of initialize the variables as globals, so remove that line. Also, the ode call needs to be outside the functio...

7 months 前 | 1

| 已接受

已回答
Deleting rows with identical time from .mat file variable
You have written your code with the assumption that the times are the same/identical, which it might look like but that isn't th...

7 months 前 | 0

| 已接受

已回答
Determine value in the 3rd column of a matrix based on the first and second column values
Use ismember - M = [3 2 10; 4 3 4; 3 1 3; 2 1 12; 2 2 10; 4 1 18; 4 2 12]; job = 3; machine = 2; idx = ismember(M(:,1:2...

8 months 前 | 0

| 已接受

已回答
Error in kinematics (line 22) disp(['Initial velocity: ', num2str(solu), ' m/s'])
The output from solve() will be a symbolic number. And symbolic numbers are not accepted as inputs to num2str, see at the end. ...

8 months 前 | 0

已回答
PLOT SYMBOLS/MARKER FOR TWO SET OF ARRAYS IN A CONTOUR
Use plot to add markers - X = linspace(-2*pi,2*pi,10); Y = linspace(0,4*pi,10); Z = sin(X) + cos(Y).'; contourf(X,Y,Z) hol...

8 months 前 | 0

| 已接受

已回答
MATLABを用いて二段階で範囲を指定したい場合
xlsread() is a deprecated function, it is not recommended to use. Utilise readmatrix instead. Use logical indexing instead of f...

8 months 前 | 1

已回答
How can I read in 100 image files from my folder titled "Images"?
See - https://in.mathworks.com/help/matlab/import_export/process-a-sequence-of-files.html

8 months 前 | 1

已回答
Shortcut for applying two functions to two arrays.
Vectorization ftw! f = @(x) [exp(x(1,:)); sin(x(2,:))]; vec = [1 3 5; 2 4 6]; out = f(vec)

8 months 前 | 1

已回答
find similar numbers within a matrix
isequal or eq, == are not the best choices when comparing floating point numbers. arr = load('M.mat') M = arr.M; P = [-3.49...

8 months 前 | 0

| 已接受

已回答
xline - draw a partial line
You will have to do that manually - %Sinosuidal data for example x = 0:0.01:10; y = sin(x); plot(x, y, 'LineWidth', 2) ...

8 months 前 | 0

| 已接受

已回答
How to use fsolve to solve matrix equations involving matrices of different dimensions?
% Calibration sigma = 1; kappa = 0.2; beta = 0.99; phi_pi = 1.5; phi_x = 0.5; sigma_i = 0.0025; sigma_g = 0.0025; sigma_...

8 months 前 | 0

已回答
Warning using integral function: Function behaves unexpectedly on array inputs
Set the 'ArrayValued' property to 1 for the integral, so that it evaluates the integral of an array/vector valued function/integ...

8 months 前 | 2

| 已接受

已回答
colorbar not working?
"Any idea why the plot comes up all black?" Because your mesh is extremely dense. I have increased the mesh density by 5 times,...

8 months 前 | 0

已回答
setting axes to a specific colour
You have to call gca first and assign it to the variable ax, and then modify the properties. Otherwise ax will be defined as a ...

8 months 前 | 0

| 已接受

已回答
fast evaluation of x(k+1) = x(k)*e(k)
Timings of for loop with preallocation and vectorization are comparable for a large number of elements - x = 69420; N = 5e6; ...

8 months 前 | 1

加载更多