Answered
Is there a way to find the mean of every other number in a vector and compare it to every other number in another vector?
I'm not sure if I am clear on what you are trying to do but from your description I would do something like this: red = [2 4 3 ...

4 years ago | 1

Answered
Trying to combine multiple square matrices diagonally into a combined larger matrix
You can use MATLAB's blkdiag function for this so in your case T = blkdiag(A,B,C)

4 years ago | 0

Answered
intersect() returns unplausible values
I think you may be misunderstanding the usage of MATLAB's intersect function. It finds the set intersection (elements in common)...

4 years ago | 0

| accepted

Answered
how can i get value of y
It looks like you are trying to solve for the root of a nonlinear function. You can use MATLAB's fzero to do this. Type doc fzer...

4 years ago | 1

Answered
If point x belongs to vertices of rectangle?
You could define a 4 by 2 array, corners, with the corner values (first column x values, second column y values) then do somethi...

4 years ago | 0

| accepted

Answered
How to solve this error : "index out of bounds because numel(U)=1"
With your definition of U, U has only one element. Note you first assign a scalar (one element) variable u=1, then you assign U ...

4 years ago | 0

| accepted

Answered
3 Excel COLUMNS x,y,z imported into work space as vectors, z is a function of x,y how do i get the data into a 2d lookup table
Here is an example MATLAB script that you could run to assign the necessary variables in your base workspace before running yo...

4 years ago | 0

| accepted

Answered
How to adjust axes created using plot
use the ylim command for example g = @(x) sin(x)/x fplot(g, [-10, 10]) title('The result of fplot') ylim([-2,2])

4 years ago | 1

Answered
How to read an image & convert it into an array and vice versa
You can use MATLAB's imread and imwrite functions for this. On the command line you can type doc imread to get documentation fo...

4 years ago | 0

Answered
How to select corresponding rows of a table based on selected rows of one column?
T = readtable('sadegh.geo_cod.xlsx'); % sort the rows of table in descending order of areas Tsrt = sortrows(T,'Area1','desce...

4 years ago | 0

| accepted

Answered
Remove successive rows from a table where a specific column value is duplicated
If I am understanding correctly I think this will do what you are asking T = readtable('Metingen-data-2021-11-17 10_48_18.csv')...

4 years ago | 0

| accepted

Answered
Using a string in an if statement to print data from excel.
put single or double quotes around yes if view_data == 'yes' and also around no in the following line

4 years ago | 0

Answered
Why do I have "Warning: Imaginary parts of complex X and/or Y arguments ignored."
Most likely you are trying to raise a negative value to a fractional power, for example x^0.5 or x^0.4 where x is negative. Thi...

4 years ago | 0

Answered
Simulink build a loop and define intial conditions
In general you should be able to run your simulation iteratively by starting the simulation programatically using the MATLAB sim...

4 years ago | 0

Answered
How to plot stair like this??
I think this does what you want and is nice and simple X = [95 0;onlyPlot] stairs(flip(X(:,2)),flip(X(:,1)),'-o')

4 years ago | 0

| accepted

Answered
Cant get for loop to run
It looks like you define f to be a scalar at the top of your script. So it doesn't make sense to iterate through values of f(n) ...

4 years ago | 0

| accepted

Answered
How do you take the absolute value of only the complex number?
x = -0.0115+0.0059i xnew = real(x) + abs(imag(x))*i

4 years ago | 0

Answered
How do I set a starting point in a find function
If you know you wanted to start the search at a known row and column index you could use iStart = 2 jStart = 3 [a,b] = find(A...

4 years ago | 1

| accepted

Answered
Ignore zero values when searching for minimum value in column of matrix
idl = cANALY(:,1)>0 % use logical indexing [tnValueAnaly, tnRowAnaly] = min(cANALY(idl,1));

4 years ago | 0

| accepted

Answered
Animated 2D ball trajectory with images
You can plot a filled circle (or an approximation of one) by plotting filled polygons using the fill command. For example to pl...

4 years ago | 0

| accepted

Answered
How to import data from excel and multiply a specific extracted column?
Hi, The problem is that you are reading the variables into tables, not vectors. You can't multiply a scalar value times a tabl...

4 years ago | 0

| accepted

Answered
MATLAB returns a wrong value of determinant.
There will always be some tolerance in numerical methods compared with exact solutions. 3.88858e-15 is considered very small, an...

4 years ago | 0

Answered
Find sequence of numbers in vector
Rather than using strings you can check a condition involving the numerical value of the elements in a, something like if a(k) ...

4 years ago | 0

Answered
How do I get the average of a signal over every certain time duration (simulink)?
So I'm assuming you are looking for an output signal that has a sampling period of 0.1 seconds, which gives the average value of...

4 years ago | 0

| accepted

Answered
intersect between the second column of cell array A (for all rows) and the first column of cell array B (for all rows)
The problem is that A{:,2} and B{:,1} are not returning arrays but instead multiple answers. So somthing like this: >> A = {1,2...

4 years ago | 0

Answered
Replace array elements with strings
In the example code below I show how to do it with 4 names, but you can expand it to however many names you have. names = {'Pis...

4 years ago | 0

| accepted

Answered
Output of loop is 2x1 vector
If you want to store the results of each loop in a 2 by numSteps matrix you can do this numSteps= 10000; %k steps c = 0.000001...

4 years ago | 0

| accepted

Answered
How to add some fluctuation in the flat line?
I think you can adapt the approach that I illustrate here: % generate original function with flat zone t = linspace(1970,1880)...

4 years ago | 0

| accepted

Answered
Concatenate tables with variable data types in columns
I think part of the problem is the NAN's in your files. They don't automatically get imported as MATLAB NaN's as you hope. It ju...

4 years ago | 0

Answered
Simulink: changing parameter mid-simulation
I would just run one simulation for 5 seconds and put in a switch as shown in the first example below. Note you could probably m...

4 years ago | 0

| accepted

Load more