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

mehr als 4 Jahre vor | 1

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

mehr als 4 Jahre vor | 0

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

mehr als 4 Jahre vor | 0

| akzeptiert

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

mehr als 4 Jahre vor | 1

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

mehr als 4 Jahre vor | 0

| akzeptiert

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

mehr als 4 Jahre vor | 0

| akzeptiert

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

mehr als 4 Jahre vor | 0

| akzeptiert

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

mehr als 4 Jahre vor | 1

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

mehr als 4 Jahre vor | 0

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

mehr als 4 Jahre vor | 0

| akzeptiert

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

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
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

mehr als 4 Jahre vor | 0

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

mehr als 4 Jahre vor | 0

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

mehr als 4 Jahre vor | 0

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

mehr als 4 Jahre vor | 0

| akzeptiert

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

mehr als 4 Jahre vor | 0

| akzeptiert

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

mehr als 4 Jahre vor | 0

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

mehr als 4 Jahre vor | 1

| akzeptiert

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

mehr als 4 Jahre vor | 0

| akzeptiert

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

mehr als 4 Jahre vor | 0

| akzeptiert

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

mehr als 4 Jahre vor | 0

| akzeptiert

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

mehr als 4 Jahre vor | 0

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

mehr als 4 Jahre vor | 0

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

mehr als 4 Jahre vor | 0

| akzeptiert

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

mehr als 4 Jahre vor | 0

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

mehr als 4 Jahre vor | 0

| akzeptiert

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

mehr als 4 Jahre vor | 0

| akzeptiert

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

mehr als 4 Jahre vor | 0

| akzeptiert

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

mehr als 4 Jahre vor | 0

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

mehr als 4 Jahre vor | 0

| akzeptiert

Mehr laden