Angwenyi David
Masinde Muliro University of Science and Technology
Followers: 0 Following: 0
Numerical Analyst.
Feeds
제출됨
Variational Methods: The Ritz Method
The Ritz Method is a precursor to the finite element method. Here is a code that provides a solution to an ODE whose solution is...
2년 초과 전 | 다운로드 수: 8 |
문제를 풀었습니다
Symmetric matrix
You must create a n-by-n *symmetric* matrix such that A(row,col) = row/col for col >= row. Example if n =3 : output is : ...
6년 초과 전
문제를 풀었습니다
Alternating sum
Given vector x, calculate the alternating sum y = x(1) - x(2) + x(3) - x(4) + ...
6년 초과 전
문제를 풀었습니다
middleAsColumn: Return all but first and last element as a column vector
Given input A, return all but the first and last elements, arranged as a column vector. (I.e., all dimensions after the first s...
6년 초과 전
문제를 풀었습니다
Reindex a vector
You are given two vectors of equal length. Vector N has numeric values (no Inf or NaN) while vector IDX has integers. Place th...
6년 초과 전
문제를 풀었습니다
Generate N equally spaced intervals between -L and L
Given N and L, return a list of numbers (in ascending order) that divides the interval [-L L] into N equal-length segments. F...
6년 초과 전
문제를 풀었습니다
First non-zero element in each column
For a given matrix, calculate the index of the first non-zero element in each column. Assuming a column with all elements zero ...
6년 초과 전
문제를 풀었습니다
Return unique values without sorting
If the input vector A is [42 1 1], the output value B must be the unique values [42 1] The *values of B are in the s...
6년 초과 전
문제를 풀었습니다
Return elements unique to either input
Given two numeric inputs a and b, return a row vector that contains the numbers found in only a or only b, but not both. For ex...
6년 초과 전
문제를 풀었습니다
Replicate elements in vectors
Replicate each element of a row vector (with NaN) a constant number of times. Examples n=2, A=[1 2 3] -> [1 1 2 2 3 3] ...
6년 초과 전
문제를 풀었습니다
Matrix indexing with two vectors of indices
Given a matrix M and two index vectors a and b, return a row vector x where x(i) = M(a(i),b(i)).
6년 초과 전
문제를 풀었습니다
Getting logical indexes
This is a basic MATLAB operation. It is for instructional purposes. --- Logical indexing works like this. thresh = 4...
6년 초과 전
문제를 풀었습니다
Getting the indices from a vector
This is a basic MATLAB operation. It is for instructional purposes. --- You may already know how to <http://www.mathworks....
6년 초과 전
문제를 풀었습니다
Set the array elements whose value is 13 to 0
Input A either an array or a vector (which can be empty) Output B will be the same size as A . All elements of A equal to 13...
6년 초과 전
문제를 풀었습니다
Find the largest value in the 3D matrix
Given a 3D matrix A, find the largest value. Example >> A = 1:9; >> A = reshape(A,[3 1 3]); >> islargest(A) a...
6년 초과 전
문제를 풀었습니다
Check if number exists in vector
Return 1 if number _a_ exists in vector _b_ otherwise return 0. a = 3; b = [1,2,4]; Returns 0. a = 3; b = [1,...
6년 초과 전
문제를 풀었습니다
Find the index of n in magic(n)
If input n=5, then magic(n) is 17 24 1 8 15 23 5 7 14 16 4 6 13 20 22...
6년 초과 전
문제를 풀었습니다
Sum of odd numbers in a matrix
Find the sum of all the odd numbers in a matrix. Example x = [2 3 5 7 1 4 11] y = 27
6년 초과 전
문제를 풀었습니다
Get all corner elements from a matrix where dimension of matrix is always equal to or greater than 2.
if a given matrix a = [1 2 3;4 5 6]; so answer is going to be [1 3;4 6]
6년 초과 전
문제를 풀었습니다
Back to basics - mean of corner elements of a matrix
Calculate the mean of corner elements of a matrix. e.g. a=[1 2 3; 4 5 6; 7 8 9;] Mean = (1+3+7+9)/4 = 5
6년 초과 전
문제를 풀었습니다
Divisible by 10
Pursuant to the <http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2 first problem> in this series, this o...
6년 초과 전
문제를 풀었습니다
Divisible by 5
Pursuant to the <http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2 first problem> in this series, this o...
6년 초과 전
문제를 풀었습니다
Divisible by 2
This is the first problem in a set of "divisible by x" problems. You will be provided a number as a string and the function you ...
6년 초과 전
문제를 풀었습니다
Distance walked 1D
Suppose you go from position 7 to 10 to 6 to 4. Then you have walked 9 units of distance, since 7 to 10 is 3 units, 10 to 6 is 4...
6년 초과 전
문제를 풀었습니다
Summing digits
Given n, find the sum of the digits that make up 2^n. Example: Input n = 7 Output b = 11 since 2^7 = 128, and 1 + ...
6년 초과 전
문제를 풀었습니다
Project Euler: Problem 6, Natural numbers, squares and sums.
The sum of the squares of the first ten natural numbers is, 1^2 + 2^2 + ... + 10^2 = 385 The square of the sum of the first ...
6년 초과 전
문제를 풀었습니다
Simple equation: Annual salary
Given an hourly wage, compute an annual salary by multiplying the wage times 40 and times 50, because salary = wage x 40 hours/w...
6년 초과 전
문제를 풀었습니다
Weighted average
Given two lists of numbers, determine the weighted average. Example [1 2 3] and [10 15 20] should result in 33.333...
6년 초과 전
문제를 풀었습니다
Number of Even Elements in Fibonacci Sequence
Find how many even fibonacci numbers are available in the first d numbers. Consider the following first 14 numbers 1 1 2...
6년 초과 전
문제를 풀었습니다
The 5th Root
Write a function to find the 5th root of a number. It sounds easy, but the typical functions are not allowed (see the test su...
6년 초과 전