Difference between revisions of "Scilab/C4/Calling-User-Defined-Functions-in-XCOS/Gujarati"

From Script | Spoken-Tutorial
Jump to: navigation, search
Line 541: Line 541:
 
| 07:37
 
| 07:37
  
|Change the '''Refresh period''' value to 10. ...............'Refresh period' वैल्यू को '10' करें।
+
| '''Refresh period''' વેલ્યુને '''10''' કરો.
  
 
|-
 
|-
Line 794: Line 794:
 
| 10:51
 
| 10:51
  
|Also generate an output whose amplitude will be half of the input.  
+
| એક આઉટપુટ પણ બનાવો જેનો મોકળાશ ઈનપુટનો અડધો હોય.
  
 
|-
 
|-
Line 800: Line 800:
 
| 10:56
 
| 10:56
  
|Go to next line by pressing '''Enter''' key and type:  
+
| એન્ટર કી દબાવો આગળની લાઈન પર જાવ અને ટાઈપ કરો:
  
 
|-
 
|-
Line 806: Line 806:
 
| 11:01
 
| 11:01
  
|'''z''' is equal to 0.5 multiplied by a put a semicolon in the end.  
+
|'''z''' is equal to 0.5 multiplied by a અંતમાં સેમીકોલન લાગડો.  
  
 
|-
 
|-
Line 812: Line 812:
 
| 11:10
 
| 11:10
  
|Now save the file.  
+
| હવે ફાઈલ સેવ કરો.
  
 
|-
 
|-
Line 818: Line 818:
 
| 11:12
 
| 11:12
  
| Switch to the '''Xcos''' window.  
+
| '''Xcos''' વિન્ડો ખોલો.
  
 
|-
 
|-
Line 824: Line 824:
 
| 11:15
 
| 11:15
  
|Double click on the '''scifunc''' block to configure it.  
+
|Double click on the '''scifunc''' block to configure it. આને કોન્ફીગર કરવા માટે  '''scifunc''' 
  
 
|-
 
|-

Revision as of 10:07, 8 January 2016

Time Narration
00:01 Calling user-defined functions in Xcos પરના આ સ્પોકન ટ્યુટોરિયલમાં તમારું સ્વાગત છે.
00:07 આ ટ્યુટોરીયલના માં આપણે શીખીશું:
00:09 * સાઈલેબમાં squaring function લખતા.
00:12 * Xcos માં scifunc બોલ્ક ઉપયોગ કરતા.
00:15 * વિવિધ પ્લોટ્સ બનાવવા માટે MUX block નો ઉપયોગ કરરતા.
00:19 * વિવિધ ઈનપુટ અને આઉટ પુટસ ધરાવતા ફંક્શન ને કોલ કરતા.
00:24 installed. હું Ubuntu 12.04 ઓપરેટીંગ સીસ્ટમ અને Scilab 5.3.3 ઉપયોગ કરી રહી છું.
00:32 આ ટ્યુટોરિયલના અભ્યાસ માટે તમને સાઈલેબઅને Xcos નું સમાન્ય જ્ઞાનની જરૂરિયાત છે.


00:38 જો નથી તો સાઈલેબ માટે સ્પોકન ટ્યુટોરિયલ વેબ સાઈટ પર ઉપલબ્ધ સંબંધિત ટ્યુટોરિયલ જુઓ.
00:44 તમારા કમ્પ્યુટર પર સાઈલેબને શરુ કરો.
00:47 સાઈલેબ કંસોલ પર ટાઈપ કરો editor અને એન્ટર દબાવો.
00:53 પછી આપેલ કોડ ટાઈપ કરો:
00:55 function space y is equal to squareit ખુલ્લો કૌંસ બંદ કૌંસ .
01:07 Enter દબાવો અને ટાઈપ કરો :
01:10 y is equal to a raise to 2
01:14 અંતમાં સેમીકોલન ઉમેરો.
01:17 ફંક્શન એક ઈનપુટ વેરીએબલ a અને એક આઉટપુટ વેરીએબલ y ધરાવે છે.
01:24 ફંક્શન નું નામ squareit છે.
01:27 આ ફંક્શન વેરીએબલ a. ને વર્ગ કરવાનું કામ કરશે.
01:31 y. હું પરિણામને y. માં સંગ્રહિત કરીશ.
01:34 હવે આ ફાઈલને ઇચ્છિત ડિરેક્ટરીમાં સેવ કરીએ.
01:38 હું આ ફાઈલને squareit નામ અને .sci એક્સ્ટેંશન સાથે સેવ કરીશ.
01:44 અહી આપણે ફંક્શનસ ને .sci ફોરમેટમાં સેવ કરવાની પરંપરા નું અનુસરણ કરી રહ્યા છીએ.
01:50 સીલેબ કંસોલ પર જઈએ.
01:53 હવે ટીપ કરો Xcos અને એન્ટર દબાવો.
01:57 બે વિન્ડો Palette browser અને Untitled Xcos વિન્ડો ખુલશે.


02:04 હવે આપણે Xcos નું ડાઈગ્રામ બનાવીશું.
02:06 squareit ફંક્શન ને એક્સેસ કરશે જે હમણાં બનાવ્યું છે.
02:10 scifunc બ્લોક નો ઉપયોગ કરીને કરી શકાય છે.
02:14 Palette browser વિન્ડો પર જઈએ.
02:17 pallet browser પર User-Defined ફંક્શન પર ક્લિક કરો.
02:21 આ સેશનમાં scifunc_block_m ને શોધો.
02:27 આને untitled Xcos વિન્ડોમાં ડ્રેગ અને ડ્રોપ કરો.
02:32 વધુ સારી રીતે જોવા માટે હું untitled Xcos વિન્ડોને ઝૂમ કરીશ.
02:36 જેવું કે તમે જોઈ રહ્યા છો હું ઝૂમ બટન નો ઉપયોગ કરી રહી છું.
02:40 હવે આને કોન્ફીગ્ર કરવા માટે scifunc બ્લોક પર ડબલ ક્લિક કરો.
02:44 Scilab Multiple Values Request નામક વિન્ડો ખુલશે.
02:49 આ વિન્ડો તમને scifunc' બ્લોક ના ઈનપુટ અને આઉટપુટ પોર્ટસ ની સંખ્યા ને બદલવાની પરવાનગી આપશે.
02:56 squareit has only one input and output variable. આપણું ફંક્શન squareit પાસે ફક્ત ઈનપુટ અને આઉટપુટ વેરીએબલ છે.
03:00 માટે આપણે સેટિંગને જેમ છે તેમ રહેવા દઈએ છીએ.
03:03 OK પર ક્લિક કરો.
03:05 એક નવું Scilab Input Value Request વિન્ડો ખુલશે .
03:09 ટેક્સ બોક્સમાં ઈનપુટ અને આઉટપુત વેરીએબલસ ના સાથે ફંક્શન નું નામ ટાઈપ કરો.
03:14 આ ફંક્શન scifunc બ્લોકથી કોલ કરવામાં આવશે.
03:18 ઉપલબ્ધ એક્સ બોક્સમાં,
03:20 ડીફોલ્ટ ફંક્શન ના નામ ને એડિટ કરો.
03:22 ટાઈપ કરો y1 equal to squareit ખુલ્લો કૌંસ u1 બંદ કૌંસ.
03:31 નોંધ લો કે અહી ઈનપુટ અને આઉટપુત વેરીએબલસ ક્રમશ: u1 અને y1 છે.
03:37 આ અચૂક રીતે u અને y ફોર્મમાં રહેવું જોઈએ અને આમાં જે વેરીએબલ નેમ આપણે ઉપયોગ કર્યો છે તે માં નહી રહેવું જોઈએ.
03:45 OK. પર ક્લિક કરો.
03:47 અન્ય Scilab Input Value Request વિન્ડો ખુલશે.
03:51 પછીની જે ત્રણ વિન્ડો ખુલશે તેમાં OK પર ક્લિક કરતા રહો.
03:56 હવે scifunc બોલ્ક કોન્ફીગર છે.
04:00 આગળ આપણે sinusoid જનરેટ બ્લોકને સમાવેશ કરીશું.
04:04 Palette browser વિન્ડો માં Sources સેક્શન પર ક્લિક કરો.


04:08 Untitled Xcos વિન્ડોમાં Sinusoid generator બોલ્કને ડ્રેગ અને ડ્રોપ કરો.
04:14 અનુકૂળતા માટે તે બ્લોકને scifunc બ્લોકથી ડાબી બાજુએ સ્થિત કરો.
04:20 હવે આપણને આઉટપુટ વેરીએબલ પ્લોટ કરવા માટે એક બ્લોકની જુરીયાત છે.
04:23 Palette browser વિન્ડોમાં , Sinks સેક્શન પર ક્લિક કરો.
04:29 Untitled Xcos વિન્ડો માં CScope બ્લોકને ડ્રેગ ને ડ્રોપ કરો.
04:34 આ બ્લોકને scifunc બ્લોક ના જમણી બાજુએ સ્થિત કરો.
04:38 અનુકૂળતા અનુસાર માટે આને scifunc બ્લોક થી જુદું સ્થિત કરો.
04:43 નોંધ લો કે CScope બ્લોક એક લાલ ઈનપુટ પોર્ટ ધરાવે છે.
04:47 આ એક ઇવેન્ટ ઈનપુટ છે.
04:49 આપણને event generator block ની જરૂરિયાત છે.
04:52 Palette browser window, માં Sources સેક્શન પર ક્લિક કરો.
04:57 CLOCK underscore c block Untitled Xcos વિન્ડોઅ ડ્રેગ અને ડ્રોપ કરો.
05:05 CScope બ્લોકના ઉપર મુકો.
05:08 નોંધ લો કે CScope બ્લોક ફક્ત એક ઈનપુટ પોર્ટ ધરાવે છે.
05:13 પણ આપણને ઈનપુટ અને આઉટપુટ બંને વેરીએબલસ ને સિંગલ પ્લોટ વિન્ડોમાં પ્લોટ કરવા ઈચ્છીએ છીએ.
05:18 છેલ્લે આપણને એક multiplexer બોલ્કની જરૂરિયાત છે.
05:22 આ બ્લોક બે ઈનપુટસ માં વિભાજીત થશે અને એક આઉટપુટ પોર્ટ પર આઉટપુટ ઉત્પન્ન કરશે.
05:28 Palette browser window, માં Signal Routing સેક્શન પર ક્લિક કરો.
05:33 MUX બ્લોકને Untitled Xcos વિન્ડોમાં ડ્રેગ અને ડ્રોપ કરો.
05:39 Place the block between the scifunc બ્લોક અને CScope બ્લોક .
05:43 ચાલો હું Mux બ્લોક ને રીસાઈઝ અને ફરી અલાઈન કરું .
05:47 હવે બ્લોકને એક સાથે જોડીએ.
05:51 Sinusoid generator બોલ્કના આઉટ પુટ પોર્ટ ને scifunc બોલ્કના ઈનપુટ પોર્ટથી જોડીએ.


05:57 હવે scifunc બોલ્ક આઉટપુટ ને MUX. ના લોઅર ઈનપુટથી જોડે છે.
06:04 MUX બ્લોક ના આઉટપુટ પોર્ટને CScope બ્લોક ના ઈનપુટ થી જોડો.
06:10 CLOCK underscore c block ના આઉટપુટના પોર્ટને CScope બોલ્કના ઇવેન્ટ ઈનપુટ પોર્ટથી જોડો.
06:19 આપણને sine ઈનપુટ ને પણ પ્લોટ કરવાનું છે.
06:22 આપણને Sinusoid generator બ્લોક ને MUX. થી જોડવાનું છે.
06:26 MUX બ્લોક ના ઉપરના ઈનપુટ પોર્ટ પર ક્લિક કરો.
06:30 પછી છોડ્યા વગર પોતાના માઉસ પોઈન્ટરને Sinusoid generator બ્લોક અને scifunc બ્લોક ના વચ્ચે વાળા લીનક પાસે લઇ જાવ.
06:39 લીંક ને વાકું કરવા માટે માઉસ બટનને છોડો અથવા સ્થિતિયો પર ક્લિક કરો.
06:44 જેમજ તમે લીંક પર પોઈન્ટર લાવો છો લીંક લીલી થયી જાય છે.
06:49 આ બંને બ્લોકસના વચ્ચેના લીંક બનાવવા માટે માઉસ બટનને છોડો અથવા એક વાર ક્લિક કરો.
06:55 હવે આપણે અન્ય બ્લોકસના કોન્ફીગ્રેશન ને જોશું.
06:59 આપણે sinusoid generator બ્લોક ની frequency, magnitude અને phase બદલી શકીએ છીએ.
07:04 આવું કરવા માટે Sinusoid generator બ્લોક પર ડબલ ક્લિક કરો.
07:09 configuration window ખુલશે .
07:11 આપણને Magnitude અને Frequency ને 1 અને Phase 0 રાખીશું.
07:18 configuration window ને બંદ કરવા માટે OK પર ક્લિક કરો.
07:21 હવે CScope બ્લોકને કોન્ફીગર કરીએ.
07:25 CScope બ્લોક to open its configuration window ને ખોલવા માટે CScope .
07:30 Ymin પેરામીટર ને માઈન્સ 2 કરો અને Ymax પેરામીટર ને 2 કરો.


07:37 Refresh period વેલ્યુને 10 કરો.
07:41 આ વેલ્યુને પછી યાદ રાખવા માટે ધ્યાન આપો.
07:44 Buffer size ને 2 થી બદલો.
07:47 OK પર ક્લિક કરો.
07:50 હવે CLOCK_c બ્લોક ને કોન્ફીગર કરીએ.
07:54 આની કોન્ફીગ્રેશન વિન્ડો ને ખોલવા માટે બ્લોક પર ડબલ ક્લિક કરો.
07:58 Period ની વેલ્યુ 0.1 રહેવા દો.
08:02 Initialisation Time ને 0 કરો.
08:06 OK પર ક્લિક કરો.
08:08 હવે Simulation પેરામીટરસ ને બદલીએ.
08:12 Untitled Xcos વિન્ડો ના મેનુ બાર પર Simulation એબ પર ક્લિક કરો.
08:17 હવે ડ્રોપ ડાઉન મેનુથી Setup પર ક્લિક કરો.
08:22 બ્લોકના Refresh period થી મેળ કરવા માટે Final Integration time ને બદલો.
08:28 Refresh period બેલ્યું 10 હતી.
08:32 તેથી Final integration time ને 10 કરો.
08:36 OK પર ક્લિક કરો.
08:38 Xcos ડાઈગ્રામ ને સેવ કરવા માટે File પર ક્લિક કરો અને પછી Save પર ક્લિક કરો.
08:44 Xcos ડાઈગ્રામ ને સેવ કરવા માટે ઈચ્છિત ડિરેક્ટરી પસંદ કરો.
08:48 તેમ છતાં જ્યાં તમે squareit.sci ફાઈલને સેવ કરીએ છે તેજ ફોલ્ડરમાં આને સેવ કરવાની સલાહ આપું છું.
08:56 OK પર ક્લિક કરો.


08:58 નોંધ લો કે scifunc બ્લોક squareit ફંક્શનને કોલ કરશે.
09:02 આનો અર્થ છે કે Xcos diagram ને એક્ઝીક્યુટ કરવાના પહેલા squareit ફંક્શનને ને લોડ કરવું જોઈએ.
09:09 Scilab editor વિન્ડો પર જાવ જ્યાં squareit.sci ફાઈલ ખુલેલી છે.
09:16 એડિટરના મેનુ બાર પર ઉપલબ્ધ Execute બટન પર ક્લિક કરો.
09:21 squareit ફંક્શનને લોડ કરશે.
09:24 હવે આપણે Xcos ડાઈગ્રામ ને એક્ઝીક્યુટ કરી શકીએ છીએ.
09:28 Xcos diagram ફાઈલને ખોલો.
09:31 Xcos વિન્ડોના મેનુ બાર પર ઉપલબ્ધ Start બટન પર ક્લિક કરો.


09:37 graphic window ખુલશે.
09:39 આ વિન્ડો બે પ્લોટસ ધરાવે છે.
09:42 કાળા રંગમાં ઈનપુટ sine wave અને લીલા રંગમાં આઉટપુટ sine wave
09:47 નોંધ લો કે squareit ફંક્શન માં squaring function લાગુ થાય છે, sine wave ખરેખર જ sine wave સ્ક્વેર ધરાવે છે.
09:55 તેથી આઉટપુટ sine વેવ પોઝીટીવ એક્સીસ પર ખસેડવામાં આવે છે.


10:00 plot વિન્ડો ને બંદ કરો .
10:02 હવે જોઈએ કે એક ફંક્શન જેમાં એક થી વધારે ઈનપુટ અને આઉટપુટ વેરીએબલસ છે જે કોલ કરવા માટે scifunc બ્લોકને કેવી રીતે એડિટ કરે છે.
10:10 scilab એડિટર વિન્ડો પર જાવ.
10:13 બે ઈનપુટ અને આઉટપુટ વેરીએબલ ધરાવતા squareit ફંક્શન ને એડિટ કરીએ.
10:19 આઉટપુટ વેરીએબલને આપેલની જેમ એડિટર કરો ખુલ્લો છગડીયો કૌંસ y comma z બંદ છગડીયો કૌંસ.
10:28 ઈનપુટ વેરીએબલસ ને આપેલની જેમ એડિટ કરો ખુલ્લો કૌંસ a comma b બંદ કૌંસ.
10:36 આપણે સ્ક્વેર આઉટપુત ને 1 યુનિટ ખસેડીને ફંક્શન ને બદલીશું.
10:41 મેઈન ફંક્શન લાઈનને આપેલની જેમ એડિટ કરો.
10:44 y is equal to b plus a raise to two અંતમાં સેમીકોલન લગાવો.
10:51 એક આઉટપુટ પણ બનાવો જેનો મોકળાશ ઈનપુટનો અડધો હોય.
10:56 એન્ટર કી દબાવો આગળની લાઈન પર જાવ અને ટાઈપ કરો:
11:01 z is equal to 0.5 multiplied by a અંતમાં સેમીકોલન લાગડો.
11:10 હવે ફાઈલ સેવ કરો.
11:12 Xcos વિન્ડો ખોલો.
11:15 Double click on the scifunc block to configure it. આને કોન્ફીગર કરવા માટે scifunc
11:19 In the input port size field, put a semi colon after 1 comma 1 and type 1 comma one again.
11:27 Similarly, in the output port size field, put a semi colon after 1 comma 1 and type 1 comma 1 again.
11:36 Click on OK.
11:38 A new Scilab Input Value Request window will open.
11:41 In the text box,
11:43 put a comma after y1 and type y2,
11:48 put y1 and y2 in square brackets,
11:52 now put a comma after u1 and type u2.
11:57 Click on OK.
11:59 Another Scilab Input Value Request window will open.
12:03 Keep clicking on OK in the subsequent 3 windows that will appear.
12:08 The scifunc block is now configured.
12:11 Let me realign the scifunc block.
12:14 Switch to the Palette browser window.
12:17 In the Sources section, drag and drop the Constant underscore m block in the Xcos window.
12:24 Place it below the Sinusoid generator block.
12:28 Connect the Constant underscore m block to the lower input of the scifunc block.
12:36 The default value of this block is 1.
12:39 Keep it unchanged.
12:41 Double click on the MUX block.
12:44 Change the input port size to 3.
12:47 Click on OK.
12:48 Let me resize the MUX block and I will connect MUX and CSCOPE block properly.
12:59 Connect the lower output port of the scifunc block to the lower input port of MUX block.
13:07 Click on File and choose Save to save the xcos file.
13:12 Switch to the Scilab editor which has the squareit.sci file open.
13:18 Click on the Execute button available on the menu bar of the editor.
13:23 This will load the squareit function.
13:26 Now we can execute the Xcos diagram.
13:30 Click on the Start button available on the menu bar of the Xcos window.
13:35 A graphic window will appear.
13:38 This window will have three plots.
13:40 Input sine wave in black color,
13:43 output sine wave in green color and
13:45 amplitude scaled input in red colour.
13:49 Notice that the function has indeed squared the input sine wave and also shifted it by an offset of 1 unit, which is as expected.
13:59 We also get the amplitude scaled of the input sine wave, as expected.
14:05 Close the plot window.
14:08 Now let us summarize.
14:10 In this tutorial we learnt:
14:12 * To write a squaring function in Scilab
14:15 * To use the scifunc block in Xcos
14:19 * To use MUX block to draw multiple plots
14:22 * To call functions having multiple input and output.
14:26 Watch the video available at the following link.
14:29 It summarizes the Spoken Tutorial project.
14:33 If you do not have good bandwidth, you can download and watch it.
14:37 The spoken tutorial project Team:
14:40 Conducts workshops using spoken tutorials.
14:43 Gives certificates for those who pass an online test.
14:47 For more details, please write to contact@spoken-tutorial.org
14:53 Spoken Tutorial Project is a part of Talk to a Teacher project.
14:57 It is supported by the National Mission on Eduction through ICT, MHRD, Government of India.
15:05 More information on this mission is available at spoken-tutorial.org/NMEICT-Intro.
15:15 Thank you for joining. Hope you found this tutorial useful.
15:19 This is Anuradha Amruthkar from IIT Bombay, signing off.

Contributors and Content Editors

Jyotisolanki