Community Profile

# David Hill

##### Last seen: Today
1 444 total contributions since 2017

View all

Contributions in
View by

Are there any functions that will return the index of the last string in a cell of strings?
find(ismember(cell,'a'),1,'last');

ungefär 3 timmar ago | 1

| accepted

Symbolic solution to a system of equations
syms a; [1,-1;2,-1]\[a;0];

ungefär 3 timmar ago | 0

How can I add a column of data to a matrix
A1=[A1;b1];

ungefär 4 timmar ago | 0

How do I call a script inside a function?
Why not just use functions? I only use scripts when I am working in the workspace. Unless you are going to call a function more ...

ungefär 9 timmar ago | 0

Applying a string of user inputs within a while-loop
Recommend breaking while loop with if statement: while 1 angle=input(['Enter the angle of trajectory [degrees] : ']); ...

ungefär 19 timmar ago | 0

Matrix dimensions must agree
Several problems I have noticed: a = 0.4; f = 10^6; w = 2*pi*f;%scalar no need for . I0 = 1; b = (0.4/2); mu0 = 4 * pi * 1...

ungefär 22 timmar ago | 0

Sorting a large 3 column data set
If I understand you correctly, can you not just subtract off a constant from both x and y coordinates to reset them to where you...

ungefär 23 timmar ago | 0

| accepted

How can i get the trigonometric function of cos and sin of a variable
Why are the users not entering numbers instead of character arrays? T1 = input('Introduce the value of Theta for row 1 = ');

ungefär 23 timmar ago | 0

The kinetic energy of a moving car object is KE=1/2mv^2
function energy = KE(m,v) energy= %put your code here end

ungefär 23 timmar ago | 0

| accepted

Functions and For Loops For Polynomials
Too bad you can't use polyval(). This might get you started. function e=evalPoly(p,a) x=1; e=0; for k=1:length(p) e=e+p...

ungefär 23 timmar ago | 0

consider preallocating for speed
No for-loop needed. No preallocation needed here. theta_2=1:360; th_2=theta_2*pi/180;%you could use cosd() and not need to con...

2 dagar ago | 0

How would I divide a 206x1 double it into 5 equal sections and average the values
I am not exactly sure what you mean. If you have matrix (M -206x1) and you want to find the mean of different groupings, then: ...

2 dagar ago | 0

Solved

Pandigital Factors (Based on Euler 491)
A Pandigital Number is a number containing all of the digits from 0-9 inclusive, with the added stipulation that it does not hav...

2 dagar ago

Solved

Bouncy numbers
Inspired by Project Euler n°112. * * Working from left-to-right if no digit is exceeded by the digit to its left it is call...

2 dagar ago

Sum of series with a variable
I always like to look at what I am doing before solving. Numerially, it should be relatively easy to find the root. alpha = 0.5...

3 dagar ago | 0

| accepted

how can i convert the content of a character array to a variable name
Generally, you should not do what you are trying to do. One possible solution is to use a struct. xx='Helo'; myStruct.(xx)=mag...

3 dagar ago | 0

| accepted

x=-10:10; for k=1:length(x) if x(k)<0 f(k)=3*x^2+5*x-7; else f(k)=3*x+4; end end

3 dagar ago | 0

n number of 2x2 matricies to diagonal matrix
n = input('Input the number of elements:'); k = ((E * avg_area)/L); k_global=diag([k,repmat(k+k,1,n-1),k])+diag(repmat(-k,1,n...

3 dagar ago | 0

| accepted

Solved

Pandigital number n°3 (Inspired by Project Euler 32)
After Problem 2319 and 2320. An n-digit number is pandigital if it makes use of all the digits 1 to n exactly ONCE. For examp...

4 dagar ago

For Loop Which Skips Numbers Based on Row Vector
n=1:1000;%not sure how far you want your for-loop to go (max(rowVector)+?) n=n(~ismember(n,rowVector)); for k=n %or 1:length(n...

6 dagar ago | 0

| accepted

Solved

Find 10's complement
Find 10's complement of a given number. An example is <http://electrical4u.com/9s-complement-and-10s-complement/ shown here>.

7 dagar ago

Solved

Change the first and last diagonal element of the identity matrix to zero
Starting with the identity matrix, change first and last diagonal element to zero. Example If n=5 A = 0 0 ...

7 dagar ago

Solved

Append two matrix as shown below example
Append two matrix as shown below example A=[1 2; 3 4] and B=[5 6;7 8] Answer must be 1 2 5 6 3...

7 dagar ago

Solved

Add two different item as shown in example
Add two different item as shown in example x=5; y='ab'; Then output must be'5ab';

7 dagar ago

Solved

Convert number from given base to other base
Convert number from given base to other base. Example 400 in base 5, find equivalent number in base 8, it is 144.

7 dagar ago

Solved

Compute LOG(1+X) in natural log
Compute LOG(1+X) in natural log

7 dagar ago

Solved

Converter temp 0 to 200 degree C to 4 to 20mA
Converter temp 0 to 200 degree C to 4 to 20mA (It is used in transmitter)

7 dagar ago

Solved

MATLAB Basic: rounding IV