Respondida
How can I find the first integer n for which the sum of the numbers below is greater than 2.5?
Here's one simple way: kmax = 10; n = 1:kmax; s = cumsum(1./n); [n' s'] kest = n(find(s>2.5,1,'first'))

más de 4 años hace | 0

Respondida
sum of complicated numbers
Consider the reduced example. N = 21; n = 1:2:N n = (1-2*mod((n-1)/2,2)).*n s = sum(n) If you must absolutely do it with ...

más de 4 años hace | 0

Respondida
How to convert 3D to 4D images
If you have a volumetric image represented in a 3D array and you want to slice it on dim 3 and arrange each slice into a frame i...

más de 4 años hace | 0

Respondida
Why do I find different SSIM values depending on whether the images' intensity information is stored in the range [0 1] or [0 255]?
You're passing images to ssim() which are improperly-scaled for their class. Many functions make assumptions about the expected...

más de 4 años hace | 0

| aceptada

Respondida
Can we assign or associate the random points only that located inside the a specific range ?
Here's a start. I used different colors for clarity, but you can change that to whatever you want. ro=1000; % radius of the l...

más de 4 años hace | 0

| aceptada

Respondida
No Plotting Done In Function With Changing Variables
The problem is how you're specifying the linetype and when you're doing the plotting. Since you're plotting each point one at a...

más de 4 años hace | 0

| aceptada

Respondida
How to find the partial sum of the series using while loop?
Using a while loop when the number of iterations is known is an unnecessary invitation for mistakes like that. You weren't incr...

más de 4 años hace | 0

| aceptada

Respondida
How do I apply distance formula for 3D coordinate points for all elements in a cell array?
How about something like this? S = load('participants_head_lefthand_righthand_positions.mat'); head_lh_rh_pos = S.participant_...

más de 4 años hace | 0

| aceptada

Respondida
Linear equation of circle
You mean like this? r = 1; y = linspace(-r,r,50); xr = sqrt(r^2 - y.^2); xl = -sqrt(r^2 - y.^2); plot([xr; xl],[y; y]) A...

más de 4 años hace | 0

| aceptada

Respondida
I am trying to write a program for a grayscale image blurring without using gaussian or conv2 function.
This should create a gaussian kernel. Padding the array is a simple and inexpensive way to deal with indexing at the image boun...

más de 4 años hace | 0

Respondida
sum in matlab coding
The first case is summing a linear increasing series between two values stored in a vector. The second is the sum of a subvecto...

más de 4 años hace | 0

| aceptada

Respondida
non zero elements in an array
I'm going to assume you're only dealing in integers here, otherwise the question arises whether values between 1 and 2 should re...

más de 4 años hace | 2

Respondida
addition loops in matlab
This works easily enough. After R2016a, you can do the same with movsum(). a = [1 1 1 0 0 1 1 1]; if any(conv(a,[1 1 1],'va...

más de 4 años hace | 0

| aceptada

Respondida
i am getting not enough input arguments error for the below code
[t,x] = ode15s(@m,[0 50],[0 0.11 0.11 0]); plot(x(:,2),x(:,3)) function dx = m(t,x) dx=zeros(4,1); dx(1) = -(1/(8200...

más de 4 años hace | 0

| aceptada

Respondida
want to generate this matrix
What's wrong with A = [1 1 0 0 0 1 0; 1 0 0 0 0 1 0; 1 1 1 0 0 1 0; 0 0 0 1 1 0 1; 0 0 0 0 0 1 0]; If...

más de 4 años hace | 0

| aceptada

Respondida
if-else statement for 4 comparison
You can do it something like this, assuming your inputs are binarized as described. A = [0;1;0;1;1;0;1]; B = [0;1;1;0;1;1;0]; ...

más de 4 años hace | 1

Respondida
How to store output mean, S.D and what column number in a matrix
Something like: A = rand(10); colmean = mean(A,1); colstd = std(A,0,1); nspec = repmat('%6.4f ',[1 size(A,1)]); fprintf...

más de 4 años hace | 0

Respondida
how to code equation this equation?
Assuming T is a function: n = @(z) n(z0)*(T(z0)/T(z))^(1+g).*exp(-u*c(z))

más de 4 años hace | 0

| aceptada

Respondida
Create (plot) sRGB gamut, using the boundary function?
This uses MIMT tools to do the job. MIMT maxchroma() works in LCHab (or other polar models) to find the envelope of maximum c...

más de 4 años hace | 0

Respondida
sum logical 1's independently for each column
If the inputs are integer-valued, just use all() A = randi([0 1],5) isfull = all(A,1) % if you really need text output for so...

más de 4 años hace | 0

| aceptada

Respondida
How to plot unsolvable equation
You can use fimplicit() https://www.mathworks.com/help/matlab/ref/fimplicit.html syms x y eq1 = y * sin( y ) == x * sin( x );...

más de 4 años hace | 0

| aceptada

Respondida
How to remove gradient line between start and end color of the colormap in filled contour plot?
That's what happens when you run contour() on data with step discontinuities. If the step goes from Zmax to Zmin, then it will ...

más de 4 años hace | 0

| aceptada

Respondida
Alternative for linspace?
Why not just use the colon operator? r = [-4 4]; n = 10; x1 = linspace(r(1),r(2),n) x2 = r(1):range(r)/(n-1):r(2) This ...

más de 4 años hace | 0

Respondida
how to open the image extension .dat
Knowing the image geometry is 90% of the battle. Imrectify() can do a good job of figuring it out, but I never wrote it to hand...

más de 4 años hace | 0

| aceptada

Respondida
Colour Associated with a Point in a Colourmap
Here. This may be close to what you're trying to do. I don't know that it's really any clearer to do this than it is to put th...

más de 4 años hace | 0

| aceptada

Respondida
How to extract color parameters of each rice grain and then how should I compare them?
Consider what information is available. The exposure doesn't seem too bad. There are some grains which seem maybe a bit more c...

más de 4 años hace | 1

| aceptada

Respondida
Add number to every value in the vectors within a cell array (without loop)
You can use cellfun() to apply an operation to the contents of a cell array. Elementwise arithmetic operations between a scalar...

más de 4 años hace | 0

| aceptada

Respondida
How can I uniformly disperse circles in an array?
This does not require any Computer Vision Toolbox functions and outputs a raster image. d = 7; % dot diameter s = [800 1000]; ...

más de 4 años hace | 1

| aceptada

Respondida
defining the center of an image and recognise the contrast disks
Consider the example: A = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/890405/image.png'); B = bware...

más de 4 años hace | 0

| aceptada

Respondida
Clabel line break for label
As far as I know, no. There isn't a proper way to do that in manual mode. See the answer here: https://www.mathworks.com/matl...

más de 4 años hace | 1

Cargar más