Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

pro 1 . When n varies from 3 to 5 0 , TDMA methods are used to determine the displacement of x 1 in equilibrium

pro1. When n varies from 3 to 50, TDMA methods are used to determine the displacement of x1 in equilibrium to find n versus x1 and graph it. Using process C++
--------------------------------------------
I got the c++ code for question 1. However, I ran the c++ code, but an error occurred. Running the c++ code provided causes about 35 errors. I want to check and get the correct c++ code. For your information, the c++ program I use is Visual Studio. (Please refer to the picture below)
Link to the answer I received : https://www.chegg.com/homework-help/questions-and-answers/pro1-n-varies-3-50-tdma-methods-used-determine-displacement-x1-equilibrium-find-n-versus-x-q180882356
The c++ code I received:
#include
#include
#include
void TDMA(const std::vector& a, const std::vector& b, const std::vector& c, const std::vector$ d,std::vector&x){
size_t n=b.size();
std::vector c_star(n,0.0);
std::vector d_star(n,0.0);
//Modify the coefficients
c_star[0]=c[0]/b[0];
d_star[0]=d[0]/b[0];
for (size_t i=1; i0){
x[i]=d_star[i]-c_star[i]*x[i+1];
}
}
int main(){
std::ofstream outfile("results.txt");
for (size_t n=3l n<=50;++n)
{
double k_n=50+2*n;
double m=2+0.05*n;
std::vector a(n-1,-k_n);
std::vector b(n,2*k_n+m);
std::vector c(n-1,-k_n);
std::vector d(n,0.0);
double F=1.0;
d[0]=F;
std::vector x(n,0.0);
TDMA(a,b,c,d,x);
std::cout<<"n="<

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2012 Administration

Authors: Adam Jorgensen, Steven Wort

1st Edition

1118106881, 9781118106884

More Books

Students also viewed these Databases questions

Question

Describe alternative paid time off policies.

Answered: 1 week ago

Question

Describe customized benefit plans.

Answered: 1 week ago