Community Profile

photo

Shubham Gupta


277 total contributions since 2017

Shubham Gupta's Badges

  • 3 Month Streak
  • Knowledgeable Level 3
  • CUP Challenge Master
  • First Answer
  • Thankful Level 1
  • Magic Numbers II Master
  • Sequences And Series I Master
  • Cody5 Easy Master
  • Solver

View details...

Contributions in
View by

Answered
Getting an empty plot
Try: clear; x = linspace(5.62,31.62); p = -10*log10((1+ (31.5844 * (x.^2)) + (11.24*x*cos(pi)))./ (32.5844*(1 + (x.^2)))); % ...

21 hours ago | 0

| accepted

Answered
Legend in a "for loop"
Try : for ii=1:length(giri) figure(3); plot(m(indice_m_0:loc(ii)),psic_pos(ii,indice_m_0:loc(ii)),'DisplayName',['ii = ',num2...

24 hours ago | 1

Answered
How can i return a value based on mutliple fields?
Try: id = find(N2.Components(:,1) == 290 & N2.Components(:,2) == 296); PowerConsequences_out = N2.PowerConsequences(id); ICTC...

24 hours ago | 0

| accepted

Answered
Sub function error within main function
Try: function volSAtsa(l , w, h) vol = volume (l, w, h); [a1, a2, a3] = sides(l, w , h); tsa = total(a1 , a2 , a3); out(vol...

1 day ago | 0

Answered
How can I make the numbers count horizontal instead of vertical?
Try a = input('What is the size of the square array? (Enter one number): ','s'); sq = str2num(a); elements = 0; for x = 1:sq...

1 day ago | 0

| accepted

Answered
Plotting daily mean values of temperature
Assuming there are no leap years in this period of time, I think you have a vector of dimesion (35040x1) (2samples*24hrs*365days...

1 day ago | 0

Answered
In an assignment A(I) = B, the number of elements in B and I must be the same.
Your: A(17:240) % is a vector of 224 elements ((240-17+1)x1) while B % is a vector of 18 elements (18x1) that's why you are...

4 days ago | 0

| accepted

Answered
how to modify input-output script to show how many line were copied.
Try: ifn = input( 'input file name: ', 's' ); ofn = input('output file name: ', 's' ); ih = fopen( ifn, 'r' ); oh = fopen(...

4 days ago | 0

| accepted

Answered
Surface area of sphere integral form
Limits should be [0, pi/2] & fun should be sin fun = @(theta) sin(theta); S = 4*pi*R^2*(integral(fun,theta_1,theta_2/2)); % t...

4 days ago | 0

Answered
How to extract Month string from day_Month_Year time variable and create a new quarterly time index?
If I understand the question correctly, this should work : Month_variable = datestr(datenum('Oct_01_2019'),'mm'); I hope it he...

4 days ago | 0

| accepted

Answered
problem in running time of my project
I changed one simple thing, it was working more efficiently for me: clc clear; tic; Input = [ 5 12 0.02 4 ...

5 days ago | 0

| accepted

Answered
How can I format a large cell of data into one big column underneath a (predeclared) title?
Try this: my_storage = titles; %foo, bar, fubar header titles my_storage_mat = [transpose(theS...

5 days ago | 0

| accepted

Answered
How do I delete multiple elements from a column array using a while loop?
This should do the job: A = [1 0 1 0 1 0 1 0]'; A(A==0) = []

5 days ago | 1

Answered
How do I create a matrix surrounding the center element?
Try: n = 5; A = zeros(n); [r,c] = find(A==0); sub = [r,c]-(n+1)/2; for i = 1:(n-1)/2 ind = find((sub(:,1)==-i&sub(:,2)>=-i...

8 days ago | 1

| accepted

Answered
a zero finding function
Hint: (for small x). You can rewrite the equation . I think rest you can solve using linear algebra.

8 days ago | 0

Answered
How can i solve?
Below code worked for me : rng default tsim = 0:0.002:10; % simulation time Amp = {-7,-5,-3,-1,1,3,5,7}; % Amplitudes dt = 0...

11 days ago | 0

Answered
How can I move through an array and a vector that need to be compared?
My undersanding for the question. For example you have a coordinates of 4 test planes (X) & coordinate for a separate referenc...

14 days ago | 0

Answered
Summation of vectors: use of sum function in loop
I think Newvalue=(1/t)*sqrt(Value); should be outside the for loop : vector=[1;2;3;4;5;6]; vectortwo=[1;3;4;5;6;8]; s=leng...

14 days ago | 1

| accepted

Answered
Converting a string to datenum format
Try: DateString = '2011-08-31T21:16:01.948Z'; RepExp = '[a-zA-Z]'; % want to replace any alphabet, indicated by [a-zA-Z] RepS...

14 days ago | 0

Answered
Problem with computing integral of a function
Using some info from this question, which you have posted again. My understanding is that you want to calculate Phi at each n & ...

15 days ago | 0

Answered
How to get text file from char
Try : clc; clear; tic fid = fopen('myFile.txt','w'); % open text file b = sprintf('0123456789'); d = 0; T = char; for ii...

15 days ago | 0

Answered
How to write a LOOP for this case?
I think this is the continuation of this question. So, once you create struture as mentioned in the above answer, you can use:...

15 days ago | 1

Answered
How to exclude some additional points from plot legend?
You can assign plot to different variables and when you use legend only use handles of the assigned variables. For e.g. figure(...

15 days ago | 0

Answered
How to summarize this code?
You can try to create structure for the data of different years: for i = 1:length(precips) precip.(['y',num2str(i+1981)]) ...

15 days ago | 0

| accepted

Answered
Can you use replace to remove all characters that aren't letters from a string?
Try str = 'I; love123 you-+'; str_new = regexprep(str,'[^a-zA-Z\s]','');

15 days ago | 0

Answered
Need help with an if loop
First, exp(x) has an expansion as follows: Now, how to define infinity? When , . So, we check if ...

18 days ago | 0

Answered
Replace specific line in a text file
One of the way could be: fid = fopen('data.dat','r'); % Open File to read replaceline = 'act= 1,0,8,-2'; % Line to...

18 days ago | 0

| accepted

Answered
compare between element of matrix in different size
To check if there is any common element between 2 vectors, you may consider using 'intersect()'. So, your if condition becomes: ...

18 days ago | 0

Answered
problem in 3d figure plotting
one of the several ways could be: fill3(X,Y,Z,'b') I hope it helps !

18 days ago | 0

| accepted

Answered
Plotting 3D Intersection
I am not sure how you actually want to plot these values. But one of the way I could think of plotting this data is by using B3:...

18 days ago | 0

| accepted

Load more