Answered
Using "if" and "disp" in a comparison of two numbers
You need to use the elseif condition. Refer to the documentation for more info - if, elseif, else a=5;%input("Give a value f...

2 years ago | 0

| accepted

Answered
Grab 20 lines and make a graph
"Can anyone tell me?" I assume you wanted to ask why that happens. You have provided a matrix as the single input to plot. ...

2 years ago | 0

Answered
Relative pose in 2D: problem 1
Given that the frame of reference is a cartesian co-ordinate system, the angle is supposed/expected to be calculated w.r.t x-axi...

2 years ago | 0

| accepted

Answered
Where is the month, day and year string stored in a plot with a datetime axis which shows hours and minutes in the xticklabel string?
The data is stored as the x-tick values. They can be edited, but not all properties can be changed. One option to specify form...

2 years ago | 0

Answered
Error using fopen for obj file
You should try these functions instead of fopen - https://in.mathworks.com/matlabcentral/fileexchange/27982-wavefront-obj-tool...

2 years ago | 1

Answered
How to plot these figures into a graph with tons of data
Assuming that you want to plot using the values in the 1st column as x-values - Firstly, you would need to convert the 1st colu...

2 years ago | 0

Answered
Obtaining max value from cyclic data
For each cycle, finding the maximum of the temperatures corresponding to the step == 3; %Read the data T = readtable('Referenc...

2 years ago | 0

| accepted

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

2 years ago | 1

Answered
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)

2 years ago | 1

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

2 years ago | 0

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

2 years ago | 0

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

2 years ago | 0

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

2 years ago | 1

| accepted

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

2 years ago | 0

| accepted

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

2 years ago | 0

| accepted

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

2 years ago | 1

| accepted

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

2 years ago | 1

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

2 years ago | 0

| accepted

Answered
一つの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...

2 years ago | 0

| accepted

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

2 years ago | 2

| accepted

Answered
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); ...

2 years ago | 0

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

2 years ago | 2

| accepted

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

2 years ago | 1

| accepted

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

2 years ago | 0

| accepted

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

2 years ago | 0

| accepted

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

2 years ago | 0

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

2 years ago | 0

| accepted

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

2 years ago | 1

Answered
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

2 years ago | 1

Answered
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)

2 years ago | 1

Load more