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

más de 4 años hace | 1

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

más de 4 años hace | 0

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

más de 4 años hace | 0

| aceptada

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

más de 4 años hace | 1

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

más de 4 años hace | 0

| aceptada

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

más de 4 años hace | 0

| aceptada

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

más de 4 años hace | 0

| aceptada

Respondida
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])

más de 4 años hace | 1

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

más de 4 años hace | 0

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

más de 4 años hace | 0

| aceptada

Respondida
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')...

más de 4 años hace | 0

| aceptada

Respondida
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

más de 4 años hace | 0

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

más de 4 años hace | 0

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

más de 4 años hace | 0

Respondida
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')

más de 4 años hace | 0

| aceptada

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

más de 4 años hace | 0

| aceptada

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

más de 4 años hace | 0

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

más de 4 años hace | 1

| aceptada

Respondida
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));

más de 4 años hace | 0

| aceptada

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

más de 4 años hace | 0

| aceptada

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

más de 4 años hace | 0

| aceptada

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

más de 4 años hace | 0

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

más de 4 años hace | 0

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

más de 4 años hace | 0

| aceptada

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

más de 4 años hace | 0

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

más de 4 años hace | 0

| aceptada

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

más de 4 años hace | 0

| aceptada

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

más de 4 años hace | 0

| aceptada

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

más de 4 años hace | 0

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

más de 4 años hace | 0

| aceptada

Cargar más