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

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

2 years ago | 0

| accepted

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

2 years ago | 0

| accepted

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

2 years ago | 0

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

2 years ago | 2

| accepted

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

2 years ago | 0

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

2 years ago | 0

| accepted

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

2 years ago | 1

Answered
How to make the arrow smaller quiver
The arrow head looks wide because the scales of the axes are skewed. When you modify the axis, you can see that the arrowhead i...

2 years ago | 0

| accepted

Answered
Categorizing range of data
Because the for loop only iterates through the last element of phsangSE, thus the rest of the elements are undefined as that's h...

2 years ago | 0

| accepted

Answered
How can I convert cell array to an arrary matrix?
in = load('cell_array.mat') x = in.ans; out = vertcat(x{:}).'

2 years ago | 0

| accepted

Answered
Mysort script error issue
Remove the clear all, close all, clc line. You generally don't need to use those commands, specially not inside a function. ...

2 years ago | 1

| accepted

Answered
something wrong in fit function
You can use either a cell array of char vectors or string array for multiple coefficients (or dependent/independent variables fo...

2 years ago | 0

| accepted

Answered
Unrecognized function or variable 'importfile'.
readtable works on the text file - T = readtable('2_ISTA00TUR_R_...1D_30S_MO.txt', 'Delimiter', ' ', ... 'ConsecutiveDel...

2 years ago | 0

| accepted

Answered
How to solve this code error? (Diffusion_equation with pedpe)
Modify the function to provide D1, D2 and a as inputs and update the pdepe() call accordingly as well - % define the parameter...

2 years ago | 0

| accepted

Answered
Is this a correct way of 3D graphing an equation with summation
It is better to let the expression be defined as a symbolic expression through-out calculations, then convert it to an anonymous...

2 years ago | 0

| accepted

Answered
why matlab can't plot signals ?
Because there's a typo, semi-colon instead of colon in defining t. % v t=0: 0.0001;0.1; t t here is a scalar, whi...

2 years ago | 0

| accepted

Answered
Test the Chebyshev Function by plotting the 13th order Chebyshev polynomial but return with wrong graph
Given the recurrence definition used, you are trying to plot the 13th order Chebyshev polynomial of the 1st kind. In that parti...

2 years ago | 1

Answered
How to place a global legend into an empty tile in a tiled layout?
Yes, you can place the legend in the empty tile by specifying the tile number. Here's a demo - %Plotting random data in the f...

2 years ago | 0

| accepted

Answered
I have a 64*64 block matrix, each block of size 4*4. I need to extract the diagonals of each block as a vector.
You can store them in an array, where each column represent the diagonal of each block. (I have assumed that the 64*64 blocks a...

2 years ago | 0

| accepted

Answered
using readtable on a csv file where some rows have partially missing data
Specify comma as the delimiter - T = readtable('climate_hourly_MB_5060600_2000_P1H.csv', 'delimiter', ',')

2 years ago | 0

| accepted

Solved


Create rectangular function.
Rectangular function - Wikipedia

2 years ago

Load more