473,811 Members | 3,532 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

drawing of functional graphs

1 New Member
how can i draw a graph of a function using visual basic.net 2010? eg graph of y=cos2x +5x
Nov 18 '11 #1
1 2665
Crusader2010
13 New Member
Basically you need to look up the System.Drawing. Graphics class on how to draw lines and points from code. After that simply create 2 perpendicular axes. Your function should look something like:

Expand|Select|Wrap|Line Numbers
  1. Public Function y(byval x as double) as double
  2.   Return (5*x) + Math.Cos(2*x)
  3. End Function 
  4.  
If you happen to pass degrees don't forget to convert them to radians before, x*Math.pi/180. Now you can give values to your function (for example in a loop incrementing x by 0.01 or something) and drawing lines between two successive points. Use as reference the two axes you drawn before.

If you want arcs (and a more fluid graph) you'll need to compute slopes and such, but you can avoid these computations by giving very very small increments to "x" and drawing lines ;) Basically any curve can be approximated as successive lines made between points very close together (check Darboux integrals, if i remember correctly).

I don't know if there are better way to do this (and they could very well be), but i hope i pointed you in the right direction.
Nov 18 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
11922
by: TheDD | last post by:
Hi all, i have a question: is there any librairy for drawing graphs with PHP? Not graphs like histogram or alike, but like a set of shapes linked together in a certain way (like a flow chart or call graph). I have found a script to handle the graph in memory but i can already do that, my problem is to draw it (it an optimal way, and without crossing
7
2390
by: Florian Lindner | last post by:
Hello, I'm looking for a program or python library to draw graphs. They should look like the that: /--------\ /--------\ | Node A | ------ belongs to ----> | Node B | \--------/ \--------/ Which is a result of the function call like that:
8
48050
by: Stefan Burger | last post by:
Those of you who are in need for drawing vector lines might be interested in the following code. DrawLine( x1, y1, x2, y2, color ) draws a vector line from any Point x1,y1 to any Point x2,y2 in any color (string format #RRGGBB) by using div-tags. regards Stefan ###############code starts here#########################
0
590
by: Ray Mitchell | last post by:
Hello, I need to write an application that displays multiple graphs on multiple tabbed sheets in a single window. The graphs are all simple X-Y line graphs like you'd see on an oscilloscope, but with labeled coordinates. I need everything (including the fonts if possible) to scale as I resize the window. I'm debating about using MFC or C# but I'd like to use C#. (I assume, however, that .NET will not work on Windows NT.) Is there...
3
1711
by: Xarky | last post by:
Hi, Is there a way of drawing graphs by using C# (Graphs having y and x axis). If yes can you suggest me some links that I can read to learn how to do so. Thanks in Advance
4
14541
by: Mist Finer | last post by:
Hi, I'm relatively new to Visual C#, I read a guide book and searched on msdn, but I haven't found any C# toolbox or code for plotting graphs. I would really appreciate if someone tells me how to do it or where to get the code. Thanks in advance.
1
1601
by: Jonathan Daugherty | last post by:
Hello, I'm looking at a number of chart-drawing libraries and modules for Python and I'd like to know which one people tend to consider the best. I've tried gdchart2 but its interface seems somewhat limited, and pychart looks nice. I'd like to find something that will let me draw graphs similar to those created by RRDtool.
1
1678
by: Suresh Bansal | last post by:
Hi all using MSCHART object in VB.NET requires to register at client node for plotting graphs in VB 2005. Using Drawing namespace of Framework 2.0 provides rich functionality for plotting but still great work needs to be done for plotting graphs. Any shortcut to plot graphs using framework 2.0 in VB 2005 making it as convenient as MSCHART object in VB6. Suresh Bansal
2
2515
by: asdf | last post by:
I was told that it is difficult to draw plots and graphs in C++, right? In matlab, if I have data, it's very easy to generate the plots, and I want to know how C++ handles such output.
2
2172
by: Sanhita Mallick | last post by:
Hi. I am a newbie to Python. I am trying to implement a Python code for graph manipulation. My graphs are about 200-500 nodes big. Excepting for the short basic graph implementation info on Python.org, where can I find more in depth info about how to express graphs in python, and how to use them in a code? Also, does anyone know of a easy way of creating the
0
9724
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9604
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10644
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10394
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7665
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6882
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5552
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.