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

Answered
How to use VARARGIN with two types of input?
You do not need to use varargin here. Store both set of values as a vectors of same dimension (i.e. both 1xN or Nx1) and define...

2 years ago | 1

Answered
How to create a group summary of table such that it takes latest values ?
It is helpful to provide/attach data (or a sample of it) with the question, so it is easier for us to work with. Also, In gener...

2 years ago | 1

| accepted

Answered
Adding anonymous functions stored in a cell
Use symbolic integration - syms x a b f = {x x^2} c = [a b]; h = 0; for j=1:numel(f) h = c(j)*int(f{j}, x, 0, 1) +...

2 years ago | 0

| accepted

Answered
Evaluate Inverse Laplace transform of a rational function
Use subs to substitute in place of a symbolic variable (or function, expression, array) - syms u %Expression fun = ((42771...

2 years ago | 0

| accepted

Answered
Script of importing data not working with no warning or error
"The problem is when i run it in editor it does not do anything!" Because there is no output defined for the function. There a...

2 years ago | 1

Answered
Matlab doesn't like my function, why?
The element-wise operators to be used here are ./ and .* (There is .^ in addition), see - Array vs Matrix Operations Also, whi...

2 years ago | 1

Answered
Error ''Array indices must be positive integers or logical values.'' when putting interval of 0.01 in a for loop
The problem stems from the use of 0 and non-integer values as indices. As the error message states - Arrays indices in MATLAB ...

2 years ago | 1

Answered
How to plot dynamic amount of contour plots within one figure
In that case, concatenate the extracted points and use min() - %Random data x = 0:0.01:5; y1 = sin(x); y2 = cos(x); y3 = ab...

2 years ago | 2

Answered
Error using mupadmex Error in MuPAD command: symbolic:sym:isAlways:LiteralCompare|0 < root(z^20 - (555455*z^19)/28224 + (21279533*z^18)/112896 - (524070713*z^17)/451584 + (331
solve() is unable to find an explicit solution to the given equation, which is expected given the degree of the polynomial - on ...

2 years ago | 1

| accepted

Load more