Gelöst


Add two numbers
Given a and b, return the sum a+b in c.

fast 10 Jahre vor

Gelöst


Select every other element of a vector
Write a function which returns every other element of the vector passed in. That is, it returns the all odd-numbered elements, s...

fast 10 Jahre vor

Beantwortet
how to count number of repeating's in data series.
This code A = [22 24 24 36 36 36 48 48 48 48 24 33 22 22]'; C = accumarray(A,1); I = unique(A); counts = [I,C(I)] ...

fast 10 Jahre vor | 3

Beantwortet
how can i plot probability density distribution of f(x)=20000/(x+100)^3, x>0 ? thanks for the help
Like this: x = linspace(0,1000); fx=20000./(x+100).^3; plot(x,fx);

fast 10 Jahre vor | 3

| akzeptiert

Gelöst


Determine if input is odd
Given the input n, return true if n is odd or false if n is even.

fast 10 Jahre vor

Gelöst


Make the vector [1 2 3 4 5 6 7 8 9 10]
In MATLAB, you create a vector by enclosing the elements in square brackets like so: x = [1 2 3 4] Commas are optional, s...

fast 10 Jahre vor

Gelöst


Times 2 - START HERE
Try out this test problem first. Given the variable x as your input, multiply it by two and put the result in y. Examples:...

fast 10 Jahre vor

Gelöst


Find the sum of all the numbers of the input vector
Find the sum of all the numbers of the input vector x. Examples: Input x = [1 2 3 5] Output y is 11 Input x ...

fast 10 Jahre vor

Beantwortet
Copy certain number from one matrix to another
This version only requires one instance of ARRAYFUN A = [1:12;2,1,1,2,2,2,1,1,2,2,2,1]'; I = (A(:,2)==2); J = dif...

fast 10 Jahre vor | 4

Beantwortet
How to calculate the errors of histogram?
Just sum the errors that belong to the specific bins: assume in bin1 are counted data x2,x6,x7,x9, then error_bin1 = e2+e6...

fast 10 Jahre vor | 3

| akzeptiert

Beantwortet
I have a 3D shape, defined with a triangular mesh model (2 matrixes: one of points; 1 of indexes of points defining triangles). I have some points of interest on this 3d shape. How can I calculate tangent planes to the surface for these points?
You need to find the tangent plane that contains all your points of interest? Are they co-planar or not? How many tnagent planes...

fast 10 Jahre vor | 3

Beantwortet
Solving complex nonpolynomial equation and find all complex roots
To find all solutions you need global solvers, but they don't exist.. One thing that you can do is trying to initialize *fsolve*...

fast 10 Jahre vor | 3

Beantwortet
What method does Matlab use to compute an approximation of an integral which contain singularities?
<https://www.mathworks.com/moler/quad.pdf>

fast 10 Jahre vor | 3

| akzeptiert

Beantwortet
How to stop a matlab process, if it exceeds certain time threshold?
<https://it.mathworks.com/help/matlab/ref/tic.html> <https://it.mathworks.com/help/matlab/ref/toc.html>

fast 10 Jahre vor | 3

Beantwortet
How to add all values greater than specific value in coloumn vector ?
If A is your vector, simply do s = sum(A(A>1));

fast 10 Jahre vor | 4

| akzeptiert

Beantwortet
write image and display
Do this. H=zeros(100); H(:,10:20)=1; H(:,80:90)=1; H(46:55,10:90)=1; imagesc(H); axis image; It should be th...

fast 10 Jahre vor | 3

| akzeptiert

Beantwortet
Finding patterns in my array
Assume A is you matrix with values from 1 to 5. You can map automatically the entries having the same value in this way: C ...

fast 10 Jahre vor | 3

| akzeptiert

Beantwortet
Splitting up a matrix - how can I do it more efficient?
This will do your work efficiently. %matrix size n = 200; m = 8; %number of rows to cut t = 20; %generate ma...

fast 10 Jahre vor | 5

| akzeptiert

Beantwortet
slash / after text .txt
Just print it before closing the file. % open your file for writing fid = fopen('test.txt','wt'); fprintf(fid,...

fast 10 Jahre vor | 4

| akzeptiert

Beantwortet
How to interpolate a function out of an array of measured points
This signal is very regular. You can decompose it by sine of cosine series, and just keep the dominant terms. An alternative is ...

fast 10 Jahre vor | 3

| akzeptiert

Beantwortet
I have to get the x values for peaks occuring in my plot? What will be the code for that?
There is Matlab function *findpeaks* <https://it.mathworks.com/help/signal/ref/findpeaks.html>

fast 10 Jahre vor | 3

| akzeptiert

Beantwortet
Array values not corresponding to condition
Your problems only arise because you used only "<" operators, so the numbers that are exactly in the middle of your intervals do...

fast 10 Jahre vor | 3

| akzeptiert

Beantwortet
Get the input text bold
Open MATLAB, select the HOME tab, click on PREFERENCES. On the left of the window appearing, click on FONTS and select what you...

fast 10 Jahre vor | 1

Beantwortet
Text cutting in the colorbar.
To export nice figures in Matalb, use this: <https://it.mathworks.com/matlabcentral/fileexchange/23629-export-fig>

fast 10 Jahre vor | 3

| akzeptiert

Beantwortet
Populating a matrix with variables
Best way to populate diagonal matrix is to use *spdiags* (see help page). For example, to obtain A=[1,2,0,0,0,0; ...

fast 10 Jahre vor | 3

Beantwortet
Error using ./ Matrix dimensions must agree.
To achieve what you want, you have to generate all possible copules of values from x and r (no matter their sizes). Given your v...

fast 10 Jahre vor | 3

Beantwortet
How to rotate a rectangle until one of the edges is parallel to the x-axis (with unknown rotation angle)?
To find the angle between the edge of the rectangle and the x-axis do simply (using your notation for vertex as x,y): c=[x(...

fast 10 Jahre vor | 4

| akzeptiert

Beantwortet
hist3 not returning expected output (weird range for indices etc)
The behaviour of hist3 is correct. Think about this: in the first dimension (say "x") you only have one coordinate number that r...

fast 10 Jahre vor | 4

| akzeptiert

Beantwortet
What is the matrix operation mnrval does with its inputs?
The reference in the Matlab help page for *mnrval* <https://it.mathworks.com/help/stats/mnrval.html> is McCullagh, P.,...

fast 10 Jahre vor | 3

| akzeptiert

Mehr laden