how to make return value in for loop ?
i have a code :

 function rad = radial(n,m);
 radial=0; %zeros(size(r)); 
 for s=0:(n-abs(m))/2
 c=(-1)^s*((factorial(n-s))/(factorial(s)*factorial(((n+abs(m))/2)-s)
 *factorial(((n-abs(m))/2)-s)))
 radial=radial+c*(radial^(n-2*s));
 end
 return radial;

but, i can return the value of radial, and then compute the radial value to loop again. how to fix ?
thanks
matlab does not need a |return| statement to return a value. to return a value you simply need to list it as an output argument of the function:

 function [output1,output2,...] = fun\_name(input1,input2,...)

you have specified an output argument |rad|, but then have totally ignored this inside your code an never allocated any value to it. you should try something like this:

 function rad = radial(n,m);
 rad = ... whatever rad is;
 end

of course this is explained quite clearly in the introductory tutorials:

<http://www.mathworks.com/help/matlab/getting-started-with-matlab.html>

and also the <http://www.mathworks.com/help/matlab/ref/function.html |function|> documentation:

<http://www.mathworks.com/help/matlab/ref/function.html>

read the documentation. it tells you how matlab works.

if you want to store all of the values of |rad| in a loop then you can use indexing.
you can find the radius in the following way. 
write the equation of the line that is perpendicular to the given tangent line. this perpendicular goes through the stated center, and intersects the tangent; the perpendicular's slope is the negative reciprocal of the stated tangent line.
find the intersection (point t) of the tangent and radius line--then use the distance formula to find the radius, which is a segment from the stated center to the point t. hint- here, we will be proceeding by differentiating the given function with respect to x and then putting $\dfrac{{dy}}{{dx}} = 0$ and afterwards substituting the given extreme values of x to obtain the two equation in terms of m and n only and then we will solve them.given, $y = m\log x + n{x^2} + x{\text{ }} \to {\text{(1)}}$ which is a function in terms of variable x.it is also given that the function represented in equation (1) has its extreme values at $x = 2$ and $x = 1$.as we know that extreme values of any function y are obtained by finding $\dfrac{{dy}}{{dx}}$ and then putting $\dfrac{{dy}}{{dx}} = 0$.by differentiating the function given by equation (1) both sides with respect to x, we get$\dfrac{{dy}}{{dx}} = \dfrac{{d\left[ {m\log x + n{x^2} + x} \right]}}{{dx}} = \dfrac{{d\left( {m\log x} \right)}}{{dx}} + \dfrac{{d\left( {n{x^2}} \right)}}{{dx}} + \dfrac{{dx}}{{dx}}$since, m and n are constants (i.e., independent of variable x) so we can take them out of the differentiation.\[   \rightarrow \dfrac{{dy}}{{dx}} = m\left[ {\dfrac{{d\left( {\log x} \right)}}{{dx}}} \right] + n\left[ {\dfrac{{d\left( {{x^2}} \right)}}{{dx}}} \right] + 1 = m\left[ {\dfrac{1}{x}} \right] + n\left[ {2x} \right] + 1 \\   \rightarrow \dfrac{{dy}}{{dx}} = \dfrac{m}{x} + 2nx + 1 \\  \]put $\dfrac{{dy}}{{dx}} = 0$ for the extreme values of the variable x, we get\[   \rightarrow 0 = \dfrac{m}{x} + 2nx + 1 \\   \rightarrow 0 = \dfrac{{m + 2n{x^2} + x}}{x} \\   \rightarrow 0 = m + 2n{x^2} + x \\   \rightarrow 2n{x^2} + x + m = 0{\text{ }} \to {\text{(2)}} \\  \]so, we are having a quadratic equation in variable x which means there will be two extreme values of x. these extreme values are $x = 2$ and $x = 1$. these two given extreme values should satisfy the quadratic equation given by equation (2).put x=2 in equation (2), we get\[   \rightarrow 2n{\left( 2 \right)^2} + 2 + m = 0 \\   \rightarrow 8n + 2 + m = 0{\text{ }} \to {\text{(3)}} \\  \]put x=1 in equation (2), we get\[   \rightarrow 2n{\left( 1 \right)^2} + 1 + m = 0 \\   \rightarrow 2n + 1 + m = 0{\text{ }} \to {\text{(4)}} \\  \]in order to obtain the values of constants m and n we will subtract equation (4) from equation (3), we have\[   \rightarrow 8n + 2 + m - \left( {2n + 1 + m} \right) = 0 - 0 \\   \rightarrow 8n + 2 + m - 2n - 1 - m = 0 \\   \rightarrow 6n + 1 = 0 \\   \rightarrow 6n = - 1 \\   \rightarrow n = \dfrac{{ - 1}}{6} \\  \]put \[n = \dfrac{{ - 1}}{6}\] in equation (4) to obtain the value of m, we have\[   \rightarrow 2\left[ {\dfrac{{ - 1}}{6}} \right] + 1 + m = 0 \\   \rightarrow \dfrac{{ - 1}}{3} + 1 + m = 0 \\   \rightarrow m = \dfrac{1}{3} - 1 = \dfrac{{1 - 3}}{3} \\   \rightarrow m = \dfrac{{ - 2}}{3} \\  \]put \[m = \dfrac{{ - 2}}{3}\] and \[n = \dfrac{{ - 1}}{6}\] to find the value for the expression $2m + 10n$, we get$  2m + 10n = 2\left[ {\dfrac{{ - 2}}{3}} \right] + 10\left[ {\dfrac{{ - 1}}{6}} \right] = \dfrac{{ - 4}}{3} - \dfrac{5}{3} = \dfrac{{ - 4 - 5}}{3} = \dfrac{{ - 9}}{3} \\   \rightarrow 2m + 10n = - 3 \\  $hence, option e is correct.note- at the extreme values for any function y, $\dfrac{{dy}}{{dx}} = 0$. also, if $\dfrac{{{d^2}y}}{{d{x^2}}} > 0$ that means at this extreme value, minima occurs (i.e., we will be getting the minimum value of y corresponding to this extreme value of x) and if $\dfrac{{{d^2}y}}{{d{x^2}}} The problem is that your pair's closure must return two different types of objects: int if you ask for "con", and the next closure on the line if you ask for "crd".


Here's one possible implementation:


Use a speaker so you can come back.



```
public static Func<string, dynamic> Pair(int x, Func<string, dynamic> y)
{
    Func<string, dynamic> pair =
           (a) =>
           {
               if (a == "con") return x;
               if (a == "crd") return y;
               throw new Exception();
           };

    return pair;
}

public static void Print(Func<string, dynamic> pair)
{
    while (true)
    {
        var next = pair("crd");
        Console.WriteLine((next == null ? "-":"+") +"> " + pair("con"));
        if (next != null)
        {
            Console.WriteLine("|");
            pair = (x) => next(x);
            continue;
        }
        break;
    }
}

        

        
        
        
 (adsbygoogle = window.adsbygoogle || []).push({});
 
        

    
```


  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

Test:



```
var pair = Pair(1,
            Pair(2,
                  Pair(3,
                        Pair(4, null))));

Print(pair);

        

        
        
        
 (adsbygoogle = window.adsbygoogle || []).push({});
 
        

    
```

output:



```
+> 1
|
+> 2
|
+> 3
|
-> 4

        

        
        
        
 (adsbygoogle = window.adsbygoogle || []).push({});
 
        

    
``` The code is as shown below 

**clc;**

**close** **all;**

**clear** **all;**

**% define n**

**n = 0:18;**

**N = 19;** **% N tap filter**

**M = (N-1)/2;**

**% define window**

**% define the filter**

**h = 1./((n-M)*pi).*sin((n-M)*pi/5).*blackman(19)'.*((n>=0)-(n>=N));**

**h(M+1) = 2/15;** **% this corresponds to n=1 where the denominator is zero**

**% plot the filter**

**figure;**

**stem(n,h,'filled');grid** **on;title('h[n]');**

**xlabel('n');ylabel('stem height');**

**% plot the frequency response of the filter**

**figure;**

**freqz(h,1);grid** **on;**

  


  


![](/image?k=f31b88da6411d9811f191c8b336bed5e)![](/image?k=d351b5006ccd60c46820c64292935f2f) welcome to mrexcel!

it actually works for me (see below). this appears to be a kind of rounding error. the way excel stores numbers causes some issues when you have decimals. it is a bit rare when comparing a cell to itself, but it can happen. you can try to use sumproduct instead, see column h.

efgh1valuescountifranksumproduct248737.76222336113.11333454287.76111f2:f4f2=countif($e$2:$e$4,">"&e2)+1g2:g4g2=rank.eq(e2,$e$2:$e$4)h2:h4h2=sumproduct(--(round($e$2:$e$4,2)>round(e2,2)))+1 let c1 and c2 are two concentric circles with center o and radius of outer circle is 5 cm.given : ac is a chord with length 8 cm that is tangent to inner circle .to find : radius of inner circle i.e. odac is a tangent for c1 at d so,od ⏊ ac [tangent at a point on the circle is perpendicular to the radius through point of contact ]so, oad is a right-angled triangle at d .also it implies that od is perpendicular to the chord ac in c2so we have,ad = dc [perpendicular from the center to the chord bisects the chord]ac = ad + dc8 = ad + adad = 4 cmin △oad by pythagoras theorem(oa)2 = (od)2 + (ad)2(5)2 = (od)2+ (4)225 = (od)2 + 16(od)2= 9od = 3 cm no i can’t, but you can look up the solution on the [hints page](http://forum.freecodecamp.org/t/freecodecamp-challenge-guide-profile-lookup/18259) if you’re ready to give up.

all you need to change is the placement of this line:

return "no such contact"

right now it’s inside the for loop (before the closing }), it needs to be outside the for loop (after the closing }) 圖片參考：http://imgcld.yimg.com/8/n/ab00135862/o/161006040753513872668990.jpg
 
首先請先 複習下列公式
 
設扇形的中心角θ弳，半徑為r，弧長為s，面積為a，則
s=rθ；a= r2θ= rs
sol: 設: ∠aob=θ 弳 (弧度) od=x
(x+2.5) θ =6 ……………………………..(1)
求黃色部分面積= (x+5)2 θ - x2θ
= θ ( x2+10x+25-x2 )
= θ (10x+25)
=5θ( x + 2.5)=30



圖片參考：http://imgcld.yimg.com/8/n/ab00135862/o/161006040753513872669011.jpg
 

圖片參考：http://imgcld.yimg.com/8/n/ab00135862/o/161006040753513872669012.jpg
 

圖片參考：http://imgcld.yimg.com/8/n/ab00135862/o/161006040753513872669033.jpg
 



 2010-06-04 23:25:06 補充：
y= |cosx|

恕不再多畫 將以文字說明

1. 當cosx >0 時 y=cosx
2. 當cosx <0 時 y = -cosx

 2010-06-04 23:26:21 補充：
注意

y=3sin2(x-π)+2

之 a , b 步驟為同一圖形

 2010-06-05 13:06:49 補充：
奇怪 1/2 通通不見了

更正

s=rθ；a=0.5 r2θ=0.5 rs

求黃色部分面積=0.5(x+5)2 θ - 0.5x2 θ
=0.5θ ( x2+10x+25-x2 )
=θ (10x+25)
=5θ( x + 2.5)=30

p.s. x2 即為 x平方

 2010-08-28 11:35:07 補充：
staff
crusty
dough
yeast
ferment
form
trap
raise
rise
flat
slab
acorn
slope
pound
protein
wheat
rye
grind
coarse
gluten
elastic
expand
carbon
dioxide
technique
wear away
grit
swiss
crush
steel
roller
rid of applying and factorization, we get, also changing by reversing n and dnote: - try to factorize that term which help in reducing expression. ```
[b]#include[/b] <stdio.h> 

[b]void[/b] [b]foo[/b]([b]int[/b] n)
{
   [b]if[/b] ( n >= 0 )
   {
	  [b]printf[/b]("%d ", n);
	  [b]foo[/b](n - 1);
   }
}

[b]void bar[/b]([b]int[/b] n)
{
   [b]if[/b] ( n >= 0 )
   {
	  [b]bar[/b](n - 1);
	  [b]printf[/b]("%d ", n);
   }
}

[b]int main[/b]() 
{
   [b]int[/b] value = 5;
   [b]foo[/b](value); [b]putchar[/b]('\n');
   [b]bar[/b](value); [b]putchar[/b]('\n');
   [b]return[/b] 0; 
}

/* my output
5 4 3 2 1 0 
0 1 2 3 4 5 
*/
```