MATLAB Answers

I want the graph

23 views (last 30 days)
Raghad Saleh
Raghad Saleh on 26 Sep 2021 at 14:04
Answered: Image Analyst on 26 Sep 2021 at 14:16

Answers (1)

Image Analyst
Image Analyst on 26 Sep 2021 at 14:16
It looks like homework, so read this:
But the question didn't actually ask you to plot it, so I can do that part for you:
% Demo by Image Analyst
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 25;
fprintf('Beginning to run %s.m ...\n', mfilename)
x = linspace(0, 12, 1000);
f = 8 * sin(x) .* exp(-x) - 1;
plot(x, f, 'b-', 'LineWidth', 3);
grid on;
title('8 * sin(x) .* exp(-x) - 1 vs. x', 'FontSize', fontSize);
xlabel('x', 'FontSize', fontSize);
ylabel('f', 'FontSize', fontSize);
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
g = gcf;
g.WindowState = 'maximized'
fprintf('Done running %s.m.\n', mfilename)
If you need help with your Newton Raphson code, please post that. We're not just going to hand it over to you since it's your homework.

Categories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!