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

mehr als 2 Jahre vor | 1

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

mehr als 2 Jahre vor | 1

| akzeptiert

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

mehr als 2 Jahre vor | 0

| akzeptiert

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

mehr als 2 Jahre vor | 0

| akzeptiert

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

mehr als 2 Jahre vor | 1

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

mehr als 2 Jahre vor | 1

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

mehr als 2 Jahre vor | 1

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

mehr als 2 Jahre vor | 2

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

mehr als 2 Jahre vor | 1

| akzeptiert

Beantwortet
What is my syntax lacking to achieve an accumulative-progressing animation of the plot?
I assume you want to add a point to the graph iteration wise. In that case, try this - %Sample values density = rand(1,10); ...

mehr als 2 Jahre vor | 1

| akzeptiert

Beantwortet
calculate the volume of a patch object
You can use convhulln which returns the volume of the convex hull as the 2nd output.

mehr als 2 Jahre vor | 0

Beantwortet
How to plot biggest positive and negative difference as a lines?
Hint - When you calculate the difference using diff(), the result is an array with an element less than the original array. So...

mehr als 2 Jahre vor | 0

Beantwortet
Combining several sets of data in an array into one numeric array to make a histogram
Use vertcat to get the data into a column vector and then use histogram - %Sample data X = {rand(22,1); (1:22).'; primes(75).'...

mehr als 2 Jahre vor | 0

| akzeptiert

Beantwortet
I have a problem with 2D plot.
%Random data x1 = 0:0.1:40; y1 = 4.*cos(x1)./(x1+2); x2 = 1:0.2:20; y2 = x2.^2./x2.^3; %Define an axes and plot on it ax...

mehr als 2 Jahre vor | 0

Beantwortet
Cant assign an input in a function with an elseif condition
The line where dt is defined in the script hw4_b is commented out, thus the variable is not defined, which when used to define o...

mehr als 2 Jahre vor | 0

Beantwortet
Non-repeating selection from sets
%Random data A = 1:3; B = 1:4; C = 1:5; D = {A, B, C} n = numel(D); %Preallocate out = cell(1, n); %Reverse orde...

mehr als 2 Jahre vor | 0

| akzeptiert

Beantwortet
scatter plot in matlab
See the documentation of scatter. You will find all the information you need in there.

mehr als 2 Jahre vor | 0

Beantwortet
what is the map in this example?
The variable map is part of the file mri.mat - %Check the file location which mri.mat load mri.mat %check the contents lo...

mehr als 2 Jahre vor | 0

Beantwortet
Excel sheet work in specific column
Well, here's a way - Fr = .1; M = .2; Kp = 0.50; lambda = 0.1; Nr = 0.1; Pr = 7; Rd = 0.5; Nb = 0.5; Nt = 0.5; H = 0.01; Ec ...

mehr als 2 Jahre vor | 0

| akzeptiert

Beantwortet
Need a space in strcat comand
You can use strjoin again - V = [1 2 3 4 5]; out1 = strjoin(["R =" strjoin(string(V),', ')]) You can also add strings like...

mehr als 2 Jahre vor | 0

| akzeptiert

Beantwortet
Subs Error while using solve function
Allocate the value to P before defining the equation solve(). T = rows(Data_full); yield = zeros(T,1); syms R P for t = 1:...

mehr als 2 Jahre vor | 0

Beantwortet
运行代码出现函数或变量无法识别
Remove the last line from the function mycg. The output is being reshaped after calling mycg in the function solve_two_poisson...

mehr als 2 Jahre vor | 0

Beantwortet
Creating a for loop based on a condition
Use break or return.

mehr als 2 Jahre vor | 0

Beantwortet
How to assign diffrent colors and shapes to diffirent groups in a plot?
If you have the Statistics and ML toolbox, you can utilize gscatter - Group = {'A','B','C','D','E'}; %You can convert to ca...

mehr als 2 Jahre vor | 0

Beantwortet
Plotting subplots in one figure, with shared axes and labels
A better option would be to use tiledlayout here as you can make shared axis labels and titles - This is a general idea, you c...

mehr als 2 Jahre vor | 0

| akzeptiert

Beantwortet
normalize all but the zeros in a vector?
%Input in = [44 0 23 19 0 0 30]; %Lazy preallocation, assuming all values are finite and not NaNs out = 0*in; %Indexing ...

mehr als 2 Jahre vor | 1

| akzeptiert

Beantwortet
How can I stack two bars next to each other on top of a single bar in a bar graph?
Here's the visualization of the approach I mentioned - S = 845; mu = 0.015; g = 9.81; T1 = 360000; T3 = 360000*3; T4 = 36...

mehr als 2 Jahre vor | 0

| akzeptiert

Beantwortet
フォルダ内の「.avi」ファイルを一度にまとめて「.mp4」ファイルに変更することはできますか?
It would be better to use video processing tools like VLC for this instead of MATLAB. See - https://www.alphr.com/batch-convert...

mehr als 2 Jahre vor | 2

Beantwortet
Quickest way for alternate indexing a vector
n = 9; u = [5:6:6*(n-1)+5; 7:6:6*(n-1)+7]; u = reshape(u, 1, [])

mehr als 2 Jahre vor | 2

Beantwortet
Convert matlab index vector to 2D array based on gaps
You can vectorize the code - seg = [12 13 14 16 17 18 20 21 22 23 24]; idx = diff(seg)~=1; out = [seg(1) seg([false idx]); s...

mehr als 2 Jahre vor | 1

| akzeptiert

Mehr laden