# DGM

Hi, I'm nobody.

I don't belong here, but I have nothing better to do.

Matlab used to be part of my work.

Now it's part of my hobbies.

That's pretty sad, really.

**Statistics**

RANK**64**

of 242.527

REPUTATION**1.930**

CONTRIBUTIONS

**23** Questions

**708** Answers

ANSWER ACCEPTANCE **
60.87%
**

VOTES RECEIVED**218**

RANK**2.066** of 16.996

REPUTATION**778**

AVERAGE RATING**5.00**

CONTRIBUTIONS**8** Files

DOWNLOADS **62**

ALL TIME DOWNLOADS**5217**

CONTRIBUTIONS**0 Posts**

CONTRIBUTIONS**0** Public Channels

AVERAGE RATING

CONTRIBUTIONS**0** Highlights

AVERAGE NO. OF LIKES

**Content Feed**

My function is running fine for small no but not for big no.Can anybody explain?

Consider: a = next_prime(17560) b = next_prime(5346551) function k = next_prime(n) k = n; while true if...

1 dag ago | 0

| accepted

How do I save the coordinates that I find freehand

An example: % generate some example test images % you don't need to do any of this inpict = repmat(double(imread('cameraman.t...

1 dag ago | 1

| accepted

How can I extract the data from this jpeg file. Any suggestion ?

Depending on what your expectations are, the answer is one of the following: You can't get what you want. You can, but you won...

1 dag ago | 0

how to store values from loop in vector

Not knowing what exactly you're doing, it's hard to give an exact or potentially simplified answer, but here's an example. p = ...

1 dag ago | 1

To read a word and indices

Something like this should be a start. fid = fopen('test.txt'); while true linx = fgetl(fid); if ~ischar(linx); br...

2 dagen ago | 1

| accepted

Why does my code only print straight lines?

Not sure it's exactly how you want it, but there's this. I put them in subplots just for the sake of clarity. You don't need t...

3 dagen ago | 0

Graphing time vs velocity

This is a starting point: % some test parameters a1 = 1; % Train acceleration (m/s^2) a2 = 1; % Train decceleration (m/s^2) ...

4 dagen ago | 0

Cross section or profile at an angle from [X, Y Data]

Consider: % generate test points in a 3-col format as described [xx yy zz] = peaks(100); rmask = (xx.^2 + yy.^2) <= 2.5^2; X...

4 dagen ago | 0

How to save the required output?

Something like this: %Select image folder A A_dir = uigetdir(); %Select image folder B B_dir = uigetdir(); %Identify file...

6 dagen ago | 1

| accepted

Unable to convert grayscale images into rgb from a folder.

imwrite() needs numeric/logical data as its primary input. You're feeding it a 3D char array of file paths. Read the file, con...

6 dagen ago | 0

| accepted

Running a forloop to add text in the black pixels only!

Consider: Str = fileread('adapthisteq.m'); % using this in place of a custom text file x = im2uint8(imread('circles.png')); %...

6 dagen ago | 0

Construct a 5 x 10 array that contains zeros. Assign elements at (row, column) (3,5), (2,4) and (1, 9) values of 44. Display the matrix.

Consider an altered example: In a 3x5 array, assign a fixed value to elements (3,3), (2,5), and (1,1) sz = [3 5]; % array size...

10 dagen ago | 0

Techniques for blending images that have overlap

This is a simple approach to doing edge-interpolation. This could also be done using interpolation tools in fewer lines, but ri...

12 dagen ago | 0

| accepted

No data points appear on the graph when I hit run

When you plot points one at a time, they are rendered as single unconnected points. Since there is no specified marker type, th...

13 dagen ago | 0

Changing the limit of for loop give different result

Without knowing where fim comes from, I don't know. I'm going to guess that fim is another image imported the same way as the g...

14 dagen ago | 0

Never ending while-loop

There are a few problems. LW(1) will never match variabel, since they're different lengths. The first 3 characters of LW will ...

15 dagen ago | 0

| accepted

I am trying to use the "findpeaks" function to find the peak in a set of data.

The documentation for findpeaks explains it better than I could: "The prominence of a peak measures how much the peak stands ou...

16 dagen ago | 0

why my matlab didn't plot anything?

Start with something like this: m = 85; g = 9.81; ti0 = 0; tf1 = 9; v0 = -20; h = 1; c1 = 11; dv1 = @(g,c1,v,m) g-c1*v/m...

16 dagen ago | 1

New matrix with only the negative numbers of another one

A = [-1 ; -2 ; 6 ; -4 ; 5 ; 10; -22; 4]; B = A(A<0)

16 dagen ago | 0

| accepted

How to update title of plot without it "wiggling"

The issue isn't with getting the right number of characters. It's an issue of character spacing. plot(rand(1,10),rand(1,10))...

16 dagen ago | 0

Find equal pentagonal and square number

This is a rather brute force method, but it still only takes 1.5ms to find the third match on my dumpster PC. n = 1:10000; p...

17 dagen ago | 2

Audio to Image Conversion

What are n and m? Is either greater than 65500? Should it be? I don't know if using factor() this way is really doing what y...

17 dagen ago | 0

| accepted

Rescale 8-bit grayscale image

Here's a start: inpict = imread('cameraman.tif'); inrange = [64 126; 127 230]; outrange = [0 120; 151 255]; % you sure you ...

18 dagen ago | 1

Create a surface from several 1D plots

Something like this: % so you have a vector for x x = linspace(0,1,10); % and a bunch of vectors for z z1 = x.^1; z2 = x.^2...

18 dagen ago | 0

| accepted

Applying a circular mask to an image

There are other posts about how to composite two images (or an image and a flat BG) https://www.mathworks.com/matlabcentral/ans...

19 dagen ago | 0

| accepted

Given a matrix of n rows and 2 columns containing the xOy coordinates of n points. Find two points with distance and return the row index of those two points

Consider: n = 10; % number of points d = 7; % distance to match P = 10*rand(n,2); % example point list D = sqrt((P(:,1)-...

19 dagen ago | 0

Why didn't I find the same answer?

b and B are not the same. They are conjugate. B=-(-1)^(alpha-1)*(1/s^2)^(alpha); In this case (alpha-1) does not equal 0.7. ...

20 dagen ago | 0

| accepted

Index in position 2 exceeds array bounds (must not exceed 1) ?

Nothing in this code guarantees that the size of b and c are identical to the size of a. If they aren't the same size, you will...

20 dagen ago | 0

How to fix "error using class. Not enough input arguments"?

You had probably shadowed the function class() with some variable by the same name -- which is something you should avoid. wh...

20 dagen ago | 0

How do I insert a variable value in legend of a plot?

There are a bunch of examples around. The sidebar shows some. Here are some others: https://www.mathworks.com/matlabcentral/a...

20 dagen ago | 0