Community Profile

photo

Ameer Hamza


Last seen: Today

Hong Kong Polytechnic University

3,761 total contributions since 2016

3.1416

Contact

Ameer Hamza's Badges

  • MATLAB Central Treasure Hunt Finisher
  • Scavenger Finisher
  • Master
  • 6 Month Streak
  • Thankful Level 2
  • CUP Challenge Master
  • Promoter
  • Commenter
  • 5-Star Galaxy Level 2
  • Explorer
  • Personal Best Downloads Level 2
  • Editor's Pick
  • First Review
  • First Submission
  • Knowledgeable Level 4

View all

Contributions in
View by

Answered
How to generate this matrices in MATLAB
You can use ndgrid() to generate i and j matrices [i, j] = ndgrid(1:8) and then simply use the formula ti = pi/16 + (i-1)*pi/...

15 minutes ago | 0

Answered
Generate some points on the plane restricted by 3 points (triangle)
This is one of the way n = 500; % number of random points p1 = [1 1 2]; p2 = [5 7 3]; p3 = [8 2 1]; ps = [p1; p2; p3]; p...

2 hours ago | 0

| accepted

Answered
How to generate probability value randomly?
Try this X = [1 , 2, 10, 5, 4]; prob = rand(size(X))

5 hours ago | 0

| accepted

Answered
Can someone please explain this code for me?
It is code for matrix multiplication of two matrices aa (dimensions ni*nj) and bb (dimensions nj*nj). Read here: https://en.wiki...

5 hours ago | 1

| accepted

Answered
Change values using repmat
I think you are trying to do something like this input = '101110'; input_num = input - '0'; fs=8000; duration = 0.1; timese...

6 hours ago | 0

| accepted

Answered
How can I fix this program with ODE45?
You are using the wrong character (’) in your code. MATLAB does not recognize it to create strings. Use the apostrophe symbol ('...

6 hours ago | 0

Answered
In Simulink, is it possible to send data to workspace in real-time using the 'ToWorkspace' block?
Read about assignin(): https://www.mathworks.com/help/matlab/ref/assignin.html

16 hours ago | 0

Answered
Matlab resizing a matrix
Try this interp1() based solution. M = rand(8314, 3); M_new = interp1(linspace(0,1,size(M,1)), M, linspace(0,1,144));

16 hours ago | 0

| accepted

Answered
objects in a common figure
This rd.name == 'IRB1600mig' is not the correct way to compare strings. Use strcmp() strcmp(rd.name, 'IRB1600mig')

16 hours ago | 0

| accepted

Answered
Cropping out two images from one big image by manually selecting the cropping are
Try this code img = imread('pears.png'); figure(); ax1 = axes(); imshow(img, 'Parent', ax1) fprintf('Drag a rectange on t...

19 hours ago | 0

| accepted

Answered
I have a 10x10 matrix file. I am trying to modify it so that I have a 100x1 matrix. When I use c_ndgrid = ndgrid(c), I get 100x1 but it is evaluating column then row. How do I get row then column?
You can use reshape() c_column = reshape(c.', [], 1) or c_column = c.'; c_column = c_column(:);

21 hours ago | 0

| accepted

Answered
What is wrong with my code?
You need to write the RK_4 function. Right now, RK_4 is the name of your current script. You can find one implementation of the ...

22 hours ago | 0

Answered
excel worksheet in matlab
readtable(): https://www.mathworks.com/help/matlab/ref/readtable.html also works for xls file.

23 hours ago | 0

Answered
Extract specific data from datalog
It will be efficient first to read the complete file and then extract these columns. data = readmatrix('Feb15data.txt'); data ...

1 day ago | 0

Answered
Error with int function
Pass the integrand as a symbolic expression syms x I = int((3*x.^2-1.2)/(x.^5+1),2,3.2)

1 day ago | 0

Answered
combination of tables across columns
Here T1 and T2 are two tables in your question T = [T1 T2]; T = [T(:,1:size(T1,2):end) T(:,2:size(T1,2):end)]

1 day ago | 0

Answered
How to set pixel values in 100*100 matrix?
Try something like this img = zeros(100, 'uint8'); idx_all = 1:numel(img); idxs = cell(1,3); for i = 1:numel(idxs)-1 id...

1 day ago | 0

Answered
Help me!!!!!!!!! Error using audioread (line 123, line 130) The filename specified was not found in the MATLAB path.
This means that don't have the file 'can.wav' on your MATLAB path. Do you have this file on your PC? If yes, it should be placed...

1 day ago | 0

Answered
Algebra: Linear Equations
If the value of these constants are known, then you can use mldivide: https://www.mathworks.com/help/matlab/ref/mldivide.html a...

1 day ago | 0

| accepted

Answered
(emd) How to get script/code from a figure/plot ?
In the figure window, go to File > Generate code. It will show the MATLAB code to generate such a figure.

2 days ago | 0

Answered
Solve for exponent variable
You need to specify the assumption that . syms x y z a b c Q N P S assume(x, 'positive') Q = x^a S = simplify(solve(Q==(x^4)...

2 days ago | 0

| accepted

Answered
How do I simulate a differential equation that has a squared derivative term in Simulink?
The block diagram seems correct. You can also use this block: https://www.mathworks.com/help/simulink/slref/mathfunction.html to...

2 days ago | 1

| accepted

Answered
How can I find if there is at least one particular element in the string?
You can convert it to a string and then find how many contains a single 1 x = [1111,1112,1121,1211,2111,2112,2121,2211,2122,211...

2 days ago | 0

Answered
Research randi, fix, round, ceil, floor functions. • Can you generate a random integer number without using randi?
All the answers can be found on following links https://www.mathworks.com/help/matlab/ref/randi.html https://www.mathworks.co...

2 days ago | 0

| accepted

Answered
How to get a plot?
You can use fplot() syms t v v = dsolve('D2v=-2*Dv-3*v+4*10*sin(5*pi*t)','v(0)=0','Dv(0)=0','t') fplot(v) Also, defining OD...

2 days ago | 0

| accepted

Answered
fixed time step for ODE45
If you are only concerned about output at fixed time-step, then you can pass tspan as a vector of time-values tspan= tcon:0.01:...

2 days ago | 0

Answered
convert each character of an array to int
Easy peasy x = '10000111101010110101'; y = x - '0'

2 days ago | 2

| accepted

Answered
compare elements of a 2x1 column vector
You can directly make the comparison using the cell array c{1} = [1;0]; c{2} = [2;3]; comp_result = c{1}(1) > c{2}(2);

2 days ago | 0

Answered
how to plot one variable against three variables ?
For solving for unknown variables, read about solve(). For plotting 3 variables against 1 variable, read about following functi...

2 days ago | 0

Answered
How to set the length of axis in figures?
The lengths in cm are only relevant when you print the figure. If you just want to control the aspect ratio, then you can use pb...

2 days ago | 0

Load more