Subjects
PRICING
COURSES
SIGN IN
Start Free Trial
Gopi A.
Passionate Student at BITS-Pilani
Tutor Satisfaction Guarantee
MATLAB
TutorMe
Question:

Write a MATLAB code for convolution of two identical rectangular pulses. Plot the given input and obtained output . Assume sampling frequency to be 5 Hz.

Gopi A.
Answer:

function [ ] = gopitask( ) fs=100; t=-5:1/fs:5; x=rectGopi(t); y=conv(x,x,'same')/fs; figure subplot(2,1,1); plot(t,x); title('Input'); subplot(2,1,2); plot(t,y); title('Output'); end rectGopi function function [ n ] = rectGopi( t ) n=zeros(1,size(t,2)); for i=1:length(t) n(i)=0; if (t(i)>=-0.5) && (t(i)<=0.5) n(i)=1; end end end

Java Programming
TutorMe
Question:

Write a java program to find inverse of a matrix .

Gopi A.
Answer:

//This is the code to find the inverse of a matrix //I've commented each sub section for better understanding. import java.util.Scanner; public class Inverse { public static void main(String argv[]) { Scanner input = new Scanner(System.in); System.out.println("Enter the dimension of square matrix: "); int n = input.nextInt(); double a[][]= new double[n][n]; System.out.println("Enter the elements of matrix: "); for(int i=0; i<n; i++) for(int j=0; j<n; j++) a[i][j] = input.nextDouble(); double d[][] = invert(a); System.out.println("The inverse is: "); for (int i=0; i<n; ++i) { for (int j=0; j<n; ++j) { System.out.print(d[i][j]+" "); } System.out.println(); } input.close(); } public static double[][] invert(double a[][]) { int n = a.length; double x[][] = new double[n][n]; double b[][] = new double[n][n]; int index[] = new int[n]; for (int i=0; i<n; ++i) b[i][i] = 1; // Transform the matrix into an upper triangle gaussian(a, index); // Update the matrix b[i][j] with the ratios stored for (int i=0; i<n-1; ++i) for (int j=i+1; j<n; ++j) for (int k=0; k<n; ++k) b[index[j]][k] -= a[index[j]][i]*b[index[i]][k]; // Perform backward substitutions for (int i=0; i<n; ++i) { x[n-1][i] = b[index[n-1]][i]/a[index[n-1]][n-1]; for (int j=n-2; j>=0; --j) { x[j][i] = b[index[j]][i]; for (int k=j+1; k<n; ++k) { x[j][i] -= a[index[j]][k]*x[k][i]; } x[j][i] /= a[index[j]][j]; } } return x; } // Method to carry out the partial-pivoting Gaussian // elimination. Here index[] stores pivoting order. public static void gaussian(double a[][], int index[]) { int n = index.length; double c[] = new double[n]; // Initialize the index for (int i=0; i<n; ++i) index[i] = i; // Find the rescaling factors, one from each row for (int i=0; i<n; ++i) { double c1 = 0; for (int j=0; j<n; ++j) { double c0 = Math.abs(a[i][j]); if (c0 > c1) c1 = c0; } c[i] = c1; } // Search the pivoting element from each column int k = 0; for (int j=0; j<n-1; ++j) { double pi1 = 0; for (int i=j; i<n; ++i) { double pi0 = Math.abs(a[index[i]][j]); pi0 /= c[index[i]]; if (pi0 > pi1) { pi1 = pi0; k = i; } } // Interchange rows according to the pivoting order int itmp = index[j]; index[j] = index[k]; index[k] = itmp; for (int i=j+1; i<n; ++i) { double pj = a[index[i]][j]/a[index[j]][j]; // Record pivoting ratios below the diagonal a[index[i]][j] = pj; // Modify other elements accordingly for (int l=j+1; l<n; ++l) a[index[i]][l] -= pj*a[index[j]][l]; } } } }

Biology
TutorMe
Question:

Why is DNA twisted in shape?

Gopi A.
Answer:

DNA is known for its familiar twisted shape. This shape is often described as a spiral staircase or twisted ladder. DNA is a nucleic acid with three main components: nitrogenous bases, deoxyribose sugars, and phosphate molecules. Interactions between water and the molecules that compose DNA cause this nucleic acid to take on a twisted shape. This shape aids in the packing of DNA into chromatin fibers, which condense to form chromosomes. The helical shape of DNA also makes DNA replication and protein synthesis possible. When necessary, the double helix unwinds and opens to allow DNA to be copied.

Send a message explaining your
needs and Gopi will reply soon.
Contact Gopi
Ready now? Request a lesson.
Start Session
FAQs
What is a lesson?
A lesson is virtual lesson space on our platform where you and a tutor can communicate. You'll have the option to communicate using video/audio as well as text chat. You can also upload documents, edit papers in real time and use our cutting-edge virtual whiteboard.
How do I begin a lesson?
If the tutor is currently online, you can click the "Start Session" button above. If they are offline, you can always send them a message to schedule a lesson.
Who are TutorMe tutors?
Many of our tutors are current college students or recent graduates of top-tier universities like MIT, Harvard and USC. TutorMe has thousands of top-quality tutors available to work with you.