Question

Can I please have help with the following in Scilab

Please write a Scilab program to solve following differential equation: y = (1-20x, 0 <= x <= 1 initial condition: y(0)- 2

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Scilab Program:

1 // Declaring the differential equation 2 function ydot-f(x, y) 3 ydot (1-2y)*x 4 endfunction 5 // Declaring the initial con

Output Snapshot:

1.9 1.8 1.6 1.S 1.4 1.3 1.2 1.1 0 0.1 02 0304 0.5 0.6 070091

Text Code:

// Declaring the differential equation
function ydot=f(x, y)
ydot=(1-2*y)*x
endfunction
// Declaring the initial condition y(0) = 2, where x0 is 0 and y0 is 2
y0=2;
x0=0;
// Declaring range of x to find the solution of differential equation
x=0:0.1:1;
// Ordinary Differential Equation Solver using ode function
y = ode(y0,x0,x,f);
// Plotting the solution
plot(x,y)

Explanation:

  • In the Scilab, // is used for single line commenting.
  • function keyword has used to declare the differential equation in the program.
  • x0 and y0 are the initial condition values.
  • x is the variable to store value ranges from 0 to 1 with the interval of 0.1.
  • ode() is used to solve the differential equation and plot() is used for plotting the solution in graphical way. Please refer function documentation to understand more about these functions.
  • Please refer code comments for the understanding purpose.
Add a comment
Know the answer?
Add Answer to:
Can I please have help with the following in Scilab Please write a Scilab program to solve following differential equat...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT