A résolu


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

plus de 14 ans il y a

A résolu


Return the largest number that is adjacent to a zero
This example comes from Steve Eddins' blog: <http://blogs.mathworks.com/steve/2009/05/27/learning-lessons-from-a-one-liner/ Lear...

plus de 14 ans il y a

A résolu


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

plus de 14 ans il y a

A résolu


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 ...

plus de 14 ans il y a

A résolu


Back and Forth Rows
Given a number n, create an n-by-n matrix in which the integers from 1 to n^2 wind back and forth along the rows as shown in the...

plus de 14 ans il y a

A résolu


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...

plus de 14 ans il y a

A résolu


Make a checkerboard matrix
Given an integer n, make an n-by-n matrix made up of alternating ones and zeros as shown below. The a(1,1) should be 1. Example...

plus de 14 ans il y a

A résolu


Triangle Numbers
Triangle numbers are the sums of successive integers. So 6 is a triangle number because 6 = 1 + 2 + 3 which can be displa...

plus de 14 ans il y a

A résolu


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...

plus de 14 ans il y a

A résolu


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:...

plus de 14 ans il y a

Réponse apportée
Cannot accèss methods of an Object after modified
You need to use handle object. Use the following line in your class definition classdef junk < handle You can then write...

plus de 14 ans il y a | 0

| A accepté

Réponse apportée
Cannot accèss methods of an Object after modified
You need to instantiate the class first in myFunction. The code as is just create a struct obj in myFunction that has a field na...

plus de 14 ans il y a | 0

Réponse apportée
Reading images from a folder ony by one
You can use |dir| and filter out the files you need, for example, let's say you want to read in all the jpg files in the folder ...

plus de 14 ans il y a | 0

Réponse apportée
compare integer values
Say you have the matrix |A|, and you have a function |foo| contains the operation you'd like to apply to elements of |A| if they...

plus de 14 ans il y a | 0

Réponse apportée
Some help to find the max value of a function?
Why not use |max|, e.g., max(Yi(:,1)) For details, see the documentation doc max

plus de 14 ans il y a | 0

| A accepté

Réponse apportée
Plotting a 3d model
You can try |mesh|, |surf| and |image| doc mesh doc surf doc image

plus de 14 ans il y a | 0

| A accepté

Réponse apportée
Receiving mtimes error for passing vector through a function and I don't know why. Help?
You need to use .* y = exp(2*sin(0.4*x))*5 .* cos(4*x);

plus de 14 ans il y a | 1

| A accepté

Réponse apportée
Erlang Random variable
In theory Erlang is the sum of exponential distributed random variables, so you can just do the same. If you have Statistics Too...

plus de 14 ans il y a | 0

| A accepté

Réponse apportée
write and reading array from 2 functions files at the same time
Looks like you want to do stream processing. I would suggest you to take a look at the example in the following page http://w...

plus de 14 ans il y a | 0

Réponse apportée
function command hellp
Then I will rewrite the other file into a function, using signatures like function [T,Z,A,B] = foo(R) Once you do that, ...

plus de 14 ans il y a | 0

Réponse apportée
function command hellp
Let's say the other file is |foo.m|, then you can modify the signature of |foo| to return those values, e.g. function [...,...

plus de 14 ans il y a | 0

Réponse apportée
Not able to rotate an object in matlab?
Hi Simar, I think your program is doing what you want it to do, it rotates the whole thing 90 degrees in respect to the x axi...

plus de 14 ans il y a | 0

| A accepté

Réponse apportée
Use Matlab to graph piece wise function
You need to use .^ when raising a vector to a power. This being said, I would just take advantage of the logical index: x =...

plus de 14 ans il y a | 0

Réponse apportée
Help to write a simple codë to split vector to subvectors
Are all Y1 through Ym equal length. If so, assume the length is N, then you can do y = reshape(Y,3*N,[]) and each colum...

plus de 14 ans il y a | 0

| A accepté

Réponse apportée
Using indices of array to define indices of cell array
Similar to what you did for vectors: C{A>3}

plus de 14 ans il y a | 0

Réponse apportée
Sum Like Kind (not cumsum)
I don't know what the format is for your serial data so I'll just give an example where I add values of y when x is within a reg...

plus de 14 ans il y a | 0

Réponse apportée
how to call a sub function in the main function
Your output, F, is never defined in f() function. In addition, you are rewriting your input x1 in that function too.

plus de 14 ans il y a | 0

Réponse apportée
Help with loop (for?)
I don't quite understand what you do with i=i', but I think what you want is Angle = rand(5,3); for m = 1:5 kinimat...

plus de 14 ans il y a | 0

| A accepté

Réponse apportée
Saving figure
You can use |imwrite| and |date| doc imwrite doc date

plus de 14 ans il y a | 0

Réponse apportée
polyfit question
It means avg_Y = 0.0042*x+2.5802 see doc polyfit

plus de 14 ans il y a | 0

| A accepté

Charger plus