
hi which code should I use to get the following matrix and be able to change the number of rows. the code in the picture doesn't work for me for some reason. thank you. I use matlab program

it needs to look like this and be a 10 by 10 matrix.
============== matlab code for the given specific problem is ===================
row = input('Enter number of the rows:');%%taking
input row
col = input('Enter number of the columns:');%% taking input
column
syms h;%% declaring system variable
syms k;%% declaring system variable
mat = sym(zeros);%% initialization of symbolic matrix
for i = 1:row%%iterating each row
for j = 1:col%% iterating each column
powh = i-j;%% calculating power of h
powk = j-1;%% calculating power of k
if powh==0 && powk==0%% if both power is 0 ,1 symbol filled
in the table
mat(i,j) = 1;
elseif powh<0 %% h power is negative 0 is filled
mat(i,j) = 0;
elseif powk==0%% k power is 0 ,h power is filled
mat(i,j) = h^powh;
elseif powh==0%% h power is 0 ,k power is filled
mat(i,j) = k^powk;
else %%both power is filled
mat(i,j) = h^powh * k^powk;
end
end
end
disp(mat);%%displaying the matrix.
----------------------------------------------------------------------------------------------------------------------------------
Screenshots of the code:
----------------------------------------------------------------------------------------------------------------------------------

![>> Untitled2 Enter number of the rows: 4 Enter number of the columns: 4 [ 1, 0, 0, 0] [ h, k, 0, 0] [ h^2, h*k, k^2, 0] [ h^3](http://img.homeworklib.com/questions/e1ab3970-6bd2-11eb-8d7f-c7387a6d5e01.png?x-oss-process=image/resize,w_560)
==================================end======================================
like the post
hi which code should I use to get the following matrix and be able to change...
% Bisection.m Lines of code 17-26 and 43-47 are bold
% This code finds the root of a function f(x) in the interval
[a, b] using the Bisection method
%
% It uses f.m to define f(x), and assumes f(x) is continuous
% It requires specification of a, b and the maximum error
% It defines error using |f(xnew)|
% Define inputs for problem
a=0; %Defines lower limit of initial bracketing interval
b=1; %Defines upper limit of initial bracketing interval...
How would I be able to get a Merge Sort to run in this code? MY CODE: #include <iostream> #include <fstream> #include <stdlib.h> #include <stdio.h> #include <time.h> using namespace std; class mergersorter { private: float array[1000] ; int n = 1000; int i=0; public: void fillArray() { for(i=1;i<=n;i++) { array[i-1]= ( rand() % ( 1000) )+1; } } void arrayout () { ...
2. What is the output of the following code fragment? n = 1; while (n <= 5) { n++; cout << n << ' '; a.1 2 3 4 5 b. 1 2 3 4 c. 1 1 1 forever d. 2 3 4 5 e. 2 3 4 5 6 3. What is the termination condition for the following While loop? while (beta > 0 && beta < 10) { cout << beta << endl; cin >> beta; }...
Matlab-How can i exit the for loop when counts exceeds the max value, then continue to the last loop and plot accepted values. counts = 0; for k = 2:length(partDiameter) overlaps = 1; while overlaps == 1 counts = counts + 1; if counts >= 10000 disp('Max particles packed') inCoord = [inCoord;[x,y]]; return; end x = (partDiameter(k)-L)*rand(1,1) + (L-partDiameter(k)/2); y = (partDiameter(k)-L)*rand(1,1) + (L-partDiameter(k)/2); % check if this x,y postion overlaps with previously packed % partices for m = 1:length(inCoord(:,1))...
I have written my code for an employee management system that stores Employee class objects into a vector, I am getting no errors until I try and compile, I am getting the error: C2679 binary '==': no operator found which takes a right-hand operand of type 'const std::string' (or there is no acceptable conversion). But I am not sure why any help would be great, Thank you! 1 2 3 4 5 6 7 8 9 10 11 12 13...
Please do this in Matlab.
Not sure if you need this code:
e cofunction [x, er, n] = FixedPoint(g, x1, maxtol, maxitr)
if nargin < 4, maxitr = 25; end
if nargin < 3, maxtol = 1e-3; end
k = 0 ;
er = 1;
x = x1;
while er >= maxtol && k < maxitr
k=k+1;
xold = x;
x=g(x);
er=abs((x-xold)/x);
fprintf('iter = %i, x = %e, er = %e ', k,x,er);
end
n=k;
if n ==...
Use R programming to solve
Q2. A matrix operator H(G; k) on a pxp symmetric matrix G (iy)- with a positive integer parameter k (k < p) yields another p×p symmetric matrix H = (hij 1 with i=k,j = k; (a) Use one single loop to construct the function H(G; k) in R (b) Generate a random matrix X of dimension 7x5, each element of which is id from N(0,1). Use the function H(G; k constructed in (a) to compute...
1. Code a breadth First traversal. 2. Code a depth First traversal. Note, your traversals should return a string listing the nodes added to the min spanning tree and the order they are added. Using Python. Starter code: from collections import deque class Edge: def __init__(self, endIndex, next = None): self.endIndex = endIndex self.next = next class Node: def __init__(self, name): self.name = name self.visited = False self.connects = None class Graph: def __init__(self): self.nodeList = [] self.size = 20...
C++ - I have a doubly linked list, but I haven't been able to get the "reverse list" option in the code to work(It's option #in the menu in the program). I received this guidance for testing: Test 4 cases by entering (in this order) c,a,z,k,l,m This tests empty list, head of list, end of list and middle of list. Then delete (in this order) a,z,l. This tests beginning, end and middle deletes. This exhaustively tests for pointer errors. #include...
Hello, I have a bug in my code, and when I run it should ask the user to enter the month and then the year and then print out the calendar for the chosen month and year. My problem with my code is that when I run it and I enter the month, it doesn't ask me for the year and it prints all the years of the month I chose. Please help! Code: #include "calendarType.h" #include <iostream> using namespace...