提问


I'm getting two answer from my function, I only want one. How do I fix this?
function payment = fare(miles,age) tot1 =0; tot2=0; tot3=0; if miles <= 1 t...

8 years 前 | 1 个回答 | 0

1

个回答

提问


My code is producing two answers, but it is only supposed to print one.
my code is producing: payment = fare(1.45,17) pay2 = 11.2500 payment = 1.6900 The code itself is: ...

8 years 前 | 1 个回答 | 0

1

个回答

提问


Hi, how do I cause the following code to recognize that 92 for q and 92 for v are both passing scores, right now it returns false.
function tf = eligible( v,q ) %ELIGIBLE Summary of this function goes here % Detailed explanation goes here t...

8 years 前 | 2 个回答 | 0

2

个回答

提问


Need to determine the fraction of a matrix of ones and zeroes that are zeroes
I need to determine the fraction of a matrix of ones and zeroes that are zeroes. My code is: function y = zero_stat(Y) ...

8 years 前 | 2 个回答 | 0

2

个回答

已回答
I need to produce a matrix that has one's along the diagonal from the upper right to the lower left
Thanks, but use of diag is explicit;y forbidden.

8 years 前 | 0

| 已接受

提问


I need to produce a matrix that has one's along the diagonal from the upper right to the lower left
I need to produce a matrix along a square matrix of size "n" that has one's along the diagonal from the upper right to the lower...

8 years 前 | 3 个回答 | 0

3

个回答

提问


I'm trying to create a matrix of odd numbers, and I'm having some trouble. Any ideas? Thanks
function orms=odd_rms(nn) lim = (nn * 2)-1; odds = nums(1:2:lim); PROBLEM IS WITH THIS LINE %(1:1:nn) = (odds(1:1:nn)...

8 years 前 | 1 个回答 | 0

1

个回答

提问


I need to receive one row vector do some math on it and return two row vectors, I'm getting an error regarding parentheses. What's wrong?
function (R1, R2) = light_speed(I) x = size(I); R1[1:1:x] = I[1:1:x]*1.609; R2[1:1:x] = I[1:1:x]/300000; end

8 years 前 | 2 个回答 | 0

2

个回答

提问


I need to sum the values around the perimeter of a matrix, is there sum function in matlab
I assume there is a sum function and attempt the following code: [x,y] =size(M) Z = M(x:-1:1, y:-1,1);

8 years 前 | 2 个回答 | 0

2

个回答

提问


How to find even positioned numbers in a vector or matrix.
Hi, if I have a matrix, say, [1 2 3; 4 5 6] and I want the 2,2 position and all even number positions within it, I can write a l...

8 years 前 | 2 个回答 | 0

2

个回答