Answered
error using function code
This error means you cannot define a function on the MATLAB command-line. You need to create an m-file and define the function i...

4 dagen ago | 0

Answered
How to set minor ticks for any particular position?
To set minor ticks at 100, 250, 750 (as the title of the question implies): figure(); xticks(-4000:500:4000); set(gca(),'XM...

4 dagen ago | 0

| accepted

Answered
Index in position 1 exceeds array bounds. Index must not exceed 1000.
%Main Equations for n=1:N-1 for i=2:M h(i,n+1)=.5.*(h(i+1,n)+h(i-1,n))-(dt./2.*dx).*(A(i+1,n)-A(i-1,n)); ...

4 dagen ago | 0

| accepted

Answered
using while in combining two vectors
A = [1;2;3]; B = [4;5;6]; n = numel(A); C = zeros(2*n,1); i = 1; while i <= n C(2*i-1) = A(i); C(2*i) = B(i); ...

4 dagen ago | 0

Answered
Using stem plot for two plots
T=4e-3; n=21; % x=linspace(0,T/2,2001); % x1=linspace(T/2,T,2001); x=linspace(0,T/2,(n+1)/2); x1=linspace(T/2,T,(n+1)/2); y...

4 dagen ago | 0

| accepted

Answered
There is no edgcol property on the Surface class.
Use EdgeCol (or the full name EdgeColor) instead of EdgCol, which is missing an e. surface('EdgeCol','interp') surface('EdgCol...

4 dagen ago | 1

| accepted

Answered
cell of characters to column
It's not clear whether you have (Case 1) a cell array of characters, like this: times_cell_char = {'0' '0' '0' '0' '0' '0' '0' ...

4 dagen ago | 1

Answered
making a plot kinda of like an errorbar plot
Something like this? x = 1:10; y = zeros(1,10); err = randn(1,10); errorbar(x,y,err,'LineStyle','none') xlim([0 11])

4 dagen ago | 0

Answered
iteratively plot in multiple figures with subplots
You are not actually instructing subplot to create axes in a specific figure, so the axes go into the current figure, which is t...

5 dagen ago | 1

| accepted

Answered
plot with contourf and define limits for x and y axis
load V.mat load U.mat load JPDF.mat Add an extra column of appropriate values to U, V, and JPDF: U(:,end+1) = 2.5; V(:,end+...

5 dagen ago | 0

| accepted

Answered
cell merge and print
Maybe something like this? M = [ ... 45 45 65 65 28 28 1 1 9 2 4 1 9 4 7 2 3 1 ]; fprintf([repmat('%d-%d...

5 dagen ago | 0

| accepted

Answered
Find the value of interpolation polynomial
"interpolating f in x = −2,0,2" To me that sounds like you should use f(x) at x = -2, 0, and 2, rather than x = -2:2, which is ...

5 dagen ago | 2

Answered
Problems with declaring the variable right
Using symbolic k1 and xkt1: syms k1 xkt1 xg= 7*2*5*1*6*3; xh= 3/10; F1=3; F2=100; T= 1/500; for i= 0:14 xkt1(i+1...

5 dagen ago | 0

| accepted

Answered
creating uber matrix composed of smaller EEG data matrices (in a for loop): undesired outcome: creates 1 number that repeats in every cell for each subject
Try changing this: tf_all(subno,:,:,:,:) = tf(subno); to this: tf_all(subno,:,:,:,:) = tf;

6 dagen ago | 1

| accepted

Answered
Storing values from inside the third loop to a variable outside the loops
Maybe something like this? a = 2:1:5; b = [1 1.2 2 2.3 3 3.3 4 5]; na = numel(a); nb = numel(b); nc = 3; final_data = Na...

6 dagen ago | 0

| accepted

Answered
Graphing Propagating Electric Field
The only error I ran into was with using axis with symbolic expressions. You can correct that error by changing this line: axis...

6 dagen ago | 0

| accepted

Answered
Help with Table and Row indexing
S = load('predictions.mat'); Predictions = S.Predictions isTruePositive = Predictions{:,'True'} == Predictions{:,'Predicted'};...

6 dagen ago | 0

| accepted

Answered
what is the meaning of (left half plane of roots)?
The left half-plane refers to the part of the complex plane where the real part is less than 0 (or <= 0 if you want to include t...

6 dagen ago | 1

| accepted

Answered
Find function in arrays
yenidendonguyegirecekler = [ -1321.6 -2119.8 -2825.5 -2937.5 -3205.4 -3340.9 -3895.0 -4080.2 -4320.9]...

6 dagen ago | 1

| accepted

Answered
Saving data as binary
k = [0 5 4]; arrayfun(@(x)dec2bin(x,max(1,ceil(log2(x)))),k,'UniformOutput',false)

6 dagen ago | 0

Answered
How to plot 11 curves with colors more than the 7 pre-defined 'y' colors?
When you use Name,Value argument pairs such as 'Color',color1, they must be the last arguments in the call to plot, and they app...

6 dagen ago | 0

Answered
Index in position 2 exceeds array bounds (must not exceed 1).
"Index in position 2 exceeds array bounds (must not exceed 1)." This error message means the code is trying to access a column ...

6 dagen ago | 0

Answered
How to create a matrix with matrices as elements? where the matrix A contains symbolic variables
It may be useful to see the fact that, for matrices A, B, and C of the given sizes, the products C*B, C*A*B, C*A^2*B, etc., are ...

6 dagen ago | 0

Answered
How can I print multiple texts that change using a for statement?
Create the text(s) you need once, before the loop, and then update them inside the loop. % t: 1-by-6 array of text objects % (...

6 dagen ago | 1

| accepted

Answered
is there a way to obtain F(-x) polynomial
Here's a way to do it by operating on the coefficients f rather than the symbolic F(x). Realize that , n even , n odd Theref...

6 dagen ago | 2

| accepted

Answered
I nee to write a code to solve a definite integral. The output format has to be fprintf.
syms x % f = -x.^3 + 3.x^2 - 2; % ^ this . should be * f = -x.^3 + 3*x^2 - 2; a=0; b=3; output = int(f, a, ...

7 dagen ago | 1

Answered
How to select consecutive rows at regular intervals?
% a matrix with 1000 rows and 5 columns M = (1:1000).'+(0:4) One way: A = M((20:50).'+(0:50:end-50),:); disp(A) Another w...

7 dagen ago | 0

| accepted

Answered
when and how to use dot multiplication
"but is .* needed in my above q equation?" Yes. t is a vector, and q0, R, L, and C are all scalars. q0=10;R=60;L=9;C=0.0005; ...

7 dagen ago | 1

Answered
How many legs 100 cows have
n_legs_per_cow = 4; % one cow has 4 legs n_cows = 1000; % 1000 cows n_legs_total = n_cows*n_legs_per_cow

7 dagen ago | 0

Load more