I want the graph

3 visualizzazioni (ultimi 30 giorni)
Raghad Saleh
Raghad Saleh il 26 Set 2021
Risposto: Image Analyst il 26 Set 2021

Risposte (1)

Image Analyst
Image Analyst il 26 Set 2021
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.

Categorie

Scopri di più su Programming in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by