0% found this document useful (0 votes)
9 views14 pages

Exercise

The document outlines a series of exercises involving mathematical computations and visualizations, including straight line equations, vector operations, circle verification, geometric series, and matrix manipulations. It also includes tasks related to plotting various functions in MATLAB, such as sine curves, 3D helixes, and log scale plots. Additionally, there are exercises focused on modifying scripts for visual clarity and validating user inputs.

Uploaded by

Devis Kant
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views14 pages

Exercise

The document outlines a series of exercises involving mathematical computations and visualizations, including straight line equations, vector operations, circle verification, geometric series, and matrix manipulations. It also includes tasks related to plotting various functions in MATLAB, such as sine curves, 3D helixes, and log scale plots. Additionally, there are exercises focused on modifying scripts for visual clarity and validating user inputs.

Uploaded by

Devis Kant
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

EXERCISE 2.

2
Problem 1: Equation of a Straight Line
Q: Compute y = mx + c for given x values, with m = 0.5 and c = -2.

Problem 2: Vector Operations


Q: Perform element-wise operations on vector t = 1:10.

A:
Problem 3: Points on a Circle
Q: Verify that points (x, y) lie on a circle of radius r = 2.

A:

Problem 4: Geometric Series


Q: Evaluate sum of geometric series with r = 0.5 and compare with theoretical limit.

A:
Problem 5: Matrix and Vector Manipulation
Q: Create a vector and a matrix, extract and display first 10 elements as column vectors.

A:
EXERCISE 2.3

1. Simple Sine Plot


Question: Plot a sine curve for y = sin(x) in the interval 0 to 2π using 100 points. Label the axes and add a custom
title.

2. Line-Styles with Data Points

Question: Plot the same sine wave along with its unconnected data points represented by circles.
3. Exponentially Decaying Sine Plot
Question: Plot the function y = e^(-0.4x) * sin(x) using 10, 50, and 100 points and observe the difference.

4. 3D Space Curve (Helix)


Question: Plot the 3D helix defined by x = sin(t), y = cos(t), and z = t for 0 ≤ t ≤ 20.

5. On-Line Help
Question: Use the MATLAB command window to access help for the plot function.

6. Log Scale Plots

Question: Use semilogx, semilogy, and loglog to plot y = x^3 with x = 0:10:1000.
7. Overlay Plots
Question: Plot y = cos(x) and its fourth-order Taylor approximation on the same graph for 0 ≤ x ≤ π.

8. Fancy 2D Plot

Question: Recreate a fancy 2D polar plot using any interesting function.


EXERCISE 2.4
Show the Center of the Circle: The task requires modifying a script to display
the center of the circle on the plot. The center should be marked with a ‘+’.
This is an essential visualization task, which allows you to identify the center of
the circle visually.

2. Change the Radius of the Circle:

3. Variables in the Workspace:

clc;
clear;
% Run your script or calculations
% Check current variables in the workspace
who
% Get detailed information about the variables
whos
% Display the values of theta, x, and y
[theta' x' y']

4. Contents of the File:


5. H1 Line:

6.Just for Fun:


EXERCISE 2.5

1. Help on function

2. Convert Celsius to Fahrenheit

3.
3.Factorial with Input Validation

You might also like