Answered
How to manage colormap and colorbar in a matlab multi-curves plot?
Say you have 30 curves approximately. I will show these with circles. R = 1:30 ; th = linspace(0,2*pi) ; cmap = jet(30) ; ...

4 years ago | 1

| accepted

Answered
How can I generate random integers from 1 to 'n' in a jagged array(matrix of different row size) ?
Read about randperm. If you want to select 4 numbers from 1 to 15. r = randperm(15,4)

4 years ago | 0

Answered
Stuck at coding newton-Rapson method
Replace this line: f2=diff(f(x)); with f2=inline(diff(f(x)));

4 years ago | 1

Answered
Hello to all, can you help me to plot y= (x+2)^(x+2)
x = linspace(0,1) ; y = (x+2).^(x+2) ; plot(x,y)

4 years ago | 0

| accepted

Answered
a function that has two inputs: a number and a row vector
function val = myfun(a,b) if numel(a) ~= 1 | size(b,1) ~=1 error('check the inputs') ; end % Do what you want end

4 years ago | 0

Answered
How to add a row above the first row of a matrix to name each column
tc = (0:15:100)'; % tc is temperature Celsius, tf is temp deg F, tf = 1.8.*tc + 32; % and tr is temp deg Rankin. tr = tf + 459...

4 years ago | 0

Answered
How to plot the y and t?
You need to call the function. Provide the input and call the function. There is small typo in your function; it seems the input...

4 years ago | 0

| accepted

Answered
Error in plot... vectors must be same length
These lines: N=30; %no of divisions; l=30; delta_x=l/N; M(1,1)=0; N(1,1)=1; % <---- over writitng values of N Why you...

4 years ago | 0

Answered
Not enough input Arguments Error & error in Height
Note that height is a inbuilt function. You have not defined the variable height which is defined in the line: MoR = ((testload...

4 years ago | 1

Answered
How do you call local functions?
function radius = r(x) SA = 4*pi*r^.2; V = (4/3)*pi*r^.3; end Save the above function inti a file r.m. (I suggest bi...

4 years ago | 0

Answered
Error while using pdist function
You cannot use whatever the word you want. There are specified words which are methods of getting the distance. X=[1,1;2,2;3,3...

4 years ago | 1

Answered
how to change value in particular column in csv file
You can read the csv files using csvread or readtable. Let A be your column. B = A ; B(A>700) = 1; B(A<700) = 1; iwant = ...

4 years ago | 0

Answered
add legend after a loop
May be something like below: figure(1) hold on for k=0:20 p=[1 2 4 k] ; r=roots(p); plot(r,'*','DisplayN...

4 years ago | 0

Answered
How do I double the size of a given matrix?
A = [ 1 2 3 4] ; iwant = repelem(A,2,1)

4 years ago | 0

Answered
How do I create multiple figure of cwt in for loop and save them on folder
May be you need th add the below shown line after loading the data from mat file. load Data_segment Data_segment = New_data ;...

4 years ago | 0

Answered
Trying to create a random date using randi and if-elseif-else statements
theday = randi(31) ; % random day out of 31 days themonth = randi(12) ; % random month out of 12 months theyears = 1980:2...

4 years ago | 1

Answered
How to create an Nn x Nn matrix from N number of matrices of n x n size each?
m = fix(samples/3) ; signma = cell(m) ; for i=1:m for j=1:m if i==j sigma{i,j}=Xv(:,i); ...

4 years ago | 0

| accepted

Answered
Get index of an x, y data point via user selection in a plot.
% random points for demo x = rand(10,1) ; y = rand(10,1) ; % Scatter plot scatter(x,y) % clicks by the user [xi,yi] = ...

4 years ago | 0

Answered
How to move array element
A = [1 1 0 0 ;1 1 1 0 ;0 0 0 0 ;0 0 0 0] ; B = [0 0 0 0 ;0 1 1 0 ;0 1 1 1 ;0 1 0 0] ; C = [1 1 0 0 ;1 1 1 0 ;0 1 1 1 ;0 1 0 ...

4 years ago | 0

Answered
Why am I getting Error "Array indices must be positive integers or logical values"?
You have not given/ shown us the function MyCenteredDifference, so we cannot check the function. But the error is simple and sta...

4 years ago | 0

Answered
can anyone help how add zero padding
May be you are typing ans = in the workspace. You just need to type ans. A = rand(10) ; size(A) ans % no error You have t...

4 years ago | 0

Answered
How to reverse the Y axis direction in a parallel plot?
figure(1) plot(rand(1,10)) figure(2) plot(rand(1,10)) set(gca, 'YDir','reverse')

4 years ago | 0

Answered
How to save structure data to excel in matlab?
Read about double, vpasolve. double(A1s.A1)

4 years ago | 0

| accepted

Answered
How to generate 2D grid map inside of a patch area
Read about inpolygon.

4 years ago | 0

Answered
Assigning Null / Multi-Dimensional Matrix
A = repmat(1:5,4,1) A(:,1:3) = []

4 years ago | 0

Answered
Reduce a matrix to unique values, randomly choose which values are discarded
Read about unique. This will give indices of unique numbers and repitions. Run a loop for each unique row, use randi and get t...

4 years ago | 0

Answered
Error using reshape-I'm not sure whats causing the issue
Your zeta is a function handle which gives you 4x4 matrix. You cannot plot it using plot. Check: t=1:0.01:3; for i = 1:leng...

4 years ago | 1

Answered
Extract only some specific elements of the arrays of a cell
C = cell(5,1) ; for i = 1:5 C{i} = rand(1,3) ; end idx = [2 5 1] ; iwant = C(idx)

4 years ago | 0

Answered
i am getting this error "Brace indexing is not supported for variables of this type" at line which contains (S_bar{i}=R{i}*T_1{i}*R_1{i}*S{i}*T{i});.
IN this line: S_bar{i}=R{i}*T_1{i}*R_1{i}*S{i}*T{i}; S is a matrix not a cell. So replace it by: S_bar{i}=R{i}*T_1{i}*R_1{i}*...

4 years ago | 0

| accepted

Answered
How to read The value shown for R in 10^n
Your r, p are 2*1 double arrays. Type: whose r p If you want to extract each element, you can by using r(1) r(2) p(1) p...

4 years ago | 0

Load more