Beantwortet
How to store a Fibonacci Sequence in an array using a for or a while loop?
After the first while loop you already have the array with the values, namely fib. A Cartesian plot would be plot(1:k, fit), for...

mehr als 11 Jahre vor | 1

Beantwortet
Precision issues when going from Fortran to Matlab
eps = 2^(-52) = 2.2204e-16 is Matlab's precision for double. e-20 is below this precision. In fact, it is below the precision o...

mehr als 11 Jahre vor | 0

Beantwortet
matrix if statement is above .5 then can I re enter it to show .5
R = randn(10)/3; R(R > 0.5) = 0.5; R(R < -0.5) = -0.5;

mehr als 11 Jahre vor | 1

Beantwortet
how to change a variable?
SumLast = D; ind = ~any(A>B, 2); SumLast(ind) = C(ind);

mehr als 11 Jahre vor | 0

Beantwortet
how to access cell array data with single for loop
C = flatten(A); D = flatten(B); using my function function [y, me] = flatten(x) %FLATTEN Flatten numeric data (N...

mehr als 11 Jahre vor | 0

Beantwortet
Help with plot legend
You have to get rid of the empty entries h(h==0) = []; name(cellfun(@isempty, name)) = []; before you can call l...

mehr als 11 Jahre vor | 0

Beantwortet
how to extend a cell array?
Sample cell C{1} = 100; C{2} = rand(2); C{3} = 'a'; % add zeros up to cell 23 C{23} = 0; z0{1} = 0; C(log...

mehr als 11 Jahre vor | 0

Beantwortet
RGB to HSV conversion then Generating a Histogram
This may get you started: I = imread('peppers.png'); HSV = rgb2hsv(I); H = HSV(:,:,1); % the hue plane hist(H(:))

mehr als 11 Jahre vor | 0

| akzeptiert

Beantwortet
filter function for aggregation of data
x = randi(10, [1 10]); % sample data F = 1/3*ones(1,3); % filter xm3 = conv(x, F, 'valid');

mehr als 11 Jahre vor | 0

Beantwortet
Histogram, change x/y-axis number jump marks
axis([0 40 0 1.1]) set(gca, 'XTick', 1:40); set(gca, 'YTick', 0:0.5:1);

mehr als 11 Jahre vor | 0

| akzeptiert

Beantwortet
having trouble with changing Matrix name
You can store matrices of different sizes in a cell array: for m=1:Nm for n=1:Nn A{m,n} = myfunction(m,n); end...

mehr als 11 Jahre vor | 2

| akzeptiert

Beantwortet
Attempted to access x_set(:,100); index out of bounds because size(x_set)=[7600,1] help
Rather than removing, set them to NaN. Otherwise you cannot preserve the 100x100 configuration: x(x<0) = NaN;

mehr als 11 Jahre vor | 0

| akzeptiert

Beantwortet
How to find common elements in two set and form a trio element set?
% define the pairs X = [1,2;1,3;1,4;2,4;2,5;3,4;3,5;4,5]; % compute indices of all possible combination of the pairs...

mehr als 11 Jahre vor | 1

| akzeptiert

Beantwortet
how to check if numbers in the vector is within range of 1:10
all(x >= 1 & x <= 10)

mehr als 11 Jahre vor | 1

Beantwortet
good evng matlab experts .i want to add 2 images of different sizes
You can extract the subimage S from image I using ind1 = 100:300; ind2 = 250:500; % sample values S = I(ind1, ind2, :)...

mehr als 11 Jahre vor | 0

Beantwortet
What is command or way to represent 8 images in 2 different figues ??
figure(1) subplot(2,2,1), imshow(I1) subplot(2,2,2), imshow(I2) subplot(2,2,3), imshow(I3) subplot(2,2,4), imshow(I4...

mehr als 11 Jahre vor | 1

| akzeptiert

Beantwortet
Is it possible to create a function for display variables with their names on figures?
That's impossible. If you pass the name, like display_in_plot('N', 'x'), the values of N and x are unknown inside the function. ...

mehr als 11 Jahre vor | 0

Beantwortet
I got an error ignoring extra legend entries.
h = legend({'Banana' 'Rose' 'Strawberry' 'Vanilla'})

mehr als 11 Jahre vor | 0

Beantwortet
Is it possible to create a function for display variables with their names on figures?
text(x, y, ['N = ' int2str(N) ', dt = ' num2str(dt) ', x = ' num2str(x) ', type = ' type])

mehr als 11 Jahre vor | 0

Beantwortet
How can I draw a parity plot?
plot(x,y, '.') line([0.5 3],[0.5 3])

mehr als 11 Jahre vor | 1

Beantwortet
Assign Numeric Values to List of Strings
That's easy Y = [ 1 1 + cumsum(diff(X - 'a' + 1) > 0)']; (and one of the reasons why I love Matlab :-))

mehr als 11 Jahre vor | 0

Beantwortet
Value not multiplying by -1
I would suggest to avoid the loop and use logical indexing: ind = Raw_data(i,3) == val; w(ind) = Raw_data(:,4); w(~in...

mehr als 11 Jahre vor | 0

| akzeptiert

Beantwortet
any returns 0 eventhough there is a non zero element in the row
Because it's just a vector (or 1 x N matrix), any(OECFINDEX) returns a single number, namely 1 in your example, and be...

mehr als 11 Jahre vor | 1

| akzeptiert

Beantwortet
clustering for a Matrix
For this example clustering would be probably overkill. It's sufficient to determine the distance to the values in the first col...

mehr als 11 Jahre vor | 0

Beantwortet
Help with plotting contour.
Use colorbar to add a colorbar that relates the colors to values, as in pcolor(peaks), colorbar

mehr als 11 Jahre vor | 0

Beantwortet
What about the character #?
There is no special thing with the hash. In some script languages it is used as the comment character, and I've seen things like...

mehr als 11 Jahre vor | 0

| akzeptiert

Beantwortet
Plotting a portion of a graph
plot(vector(50:70))

mehr als 11 Jahre vor | 0

Beantwortet
how to rectify the below error...
You don't have to close Matlab, just close all Probably you have opened files using fopen, and forgot to close them usin...

mehr als 11 Jahre vor | 1

| akzeptiert

Beantwortet
how to construct huffmandict for an image?
You need to count the occurrences of all unique values; hist does not do that by default, use histu instead: A = imread('le...

mehr als 11 Jahre vor | 0

Beantwortet
rearranging txt file in matlab
D = textscan(fopen('test.txt'), '%f'); % format to rows with N=26 values N = 26; D = reshape(D{1}, [], N);

mehr als 11 Jahre vor | 0

Mehr laden