主要内容

Results for


Exciting news for students! 🚀Simulink Student Challenge 2023 is live! Unleash your engineering skills and compete for exciting rewards. Submission deadline is December 12th, 2023!
Adam and Heather will be discussing new features in R2023b and answering your questions in a few hours - visit the link below to check out the preview and sign up for notification.
Adam Danz just launched a new blog about MATLAB Graphics and App Building.
As you know, He has been a prolific contributor to MATLAB Answers and one of his answers recently won the Editor's Choice Award.
If there are any topics or questions you are interested in, please share with Adam, and I am sure he will get those into his blog.
Over the weekend I came across a pi approximation using durations of years and weeks (image below, Wolfram, eq. 89), accurate to 6 digits using the average Gregorian year (365.2425 days).
Here it is in MATLAB. I divided by 1 week at the end rather than multiplying by its reciprocal because you can’t divide a numeric by a duration in MATLAB (1/week).
weeks = @(n)n*days(7);
piApprox = ((years(13)-weeks(6))/years(13) + weeks(3)) / weeks(1)
% piApprox = 3.141593493469302
Here’s a breakdown
  • The first argument becomes 12.885 yrs / 13 yrs or 0.99115
  • Add three weeks: 0.99115 + 3 weeks = 21.991 days
  • The reduced fraction becomes 21.991 days / 7 days
Now it looks a lot closer to the more familiar approximation for pi 22/7 but with greater precision!
I'm curious how the community uses the hold command when creating charts and graphics in MATLAB. In short, hold on sets up the axes to add new objects to the axes while hold off sets up the axes to reset when new objects are added.
When you use hold on do you always follow up with hold off? What's your reasoning on this decision?
Can't wait to discuss this here! I'd love to hear from newbies and experts alike!
Calling all students! New to MATLAB or need helpful resources? Check out our MATLAB GitHub for Students repository! Find MATLAB examples, videos, cheat sheets, and more!
Visit the repository here: MATLAB GitHub for Students
The way we've solved ODEs in MATLAB has been relatively unchanged at the user-level for decades. Indeed, I consider ode45 to be as iconic as backslash! There have been a few new solvers in recent years -- ode78 and ode89 for example -- and various things have gotten much faster but if you learned how to solve ODEs in MATLAB in 1997 then your knowledge is still applicable today.
In R2023b, there's a completely new framework for solving ODEs and I love it! You might argue that I'm contractually obliged to love it since I'm a MathWorker but I can assure you this is the real thing!
The new interface makes a lot of things a much easier to do. Its also setting us up for a future where we'll be able to do some very cool algorithmic stuff behind the scenes.
Let me know what you think of the new functionality and what you think MathWorks should be doing next in the area of ODEs.
4 months ago, the new API was published to access content on the MATLAB Central community. I shared my MATLAB code to access the API at that time, but the team just released the official SDK.
Houman and Rameez will talk about how you can model wireless networks (5G, WLAN, Bluetooth, 802.11ax WLAN mesh, etc.) in MATLAB in the upcoming livestream. They will start with the basics such as nodes, links, topology and metrics. Then they will introduce a new free add-on library that lets you model such networks, and show you how to use it.
Bookmark this link:
Congratulations, @Adam Danz for winning the Editor's Pick badge awarded for MATLAB Answers, in recognition of your awesome solution in overlapping images in grid layout.
Thank you for going to great lengths to help a user in this thread by suggesting alternative approach to representing stack of playing cards in MATLAB, highlighting very interesting features like hggroup.
This badge recognizes awesome answers people contribute and yours was picked for providing a very detailed and helpful answer.
Thank you so much for setting a high standard for MATLAB Answers and for your ongoing contribution to the community.
MATLAB Central Team
Congratuations, @Voss, for htting this important miletone!
You had a meteoric rise to in our community since you started answering questions in June 2020.
You provided 3218 answers and 926 votes. You are ranked #23 in the community. Thank you for your contribution to the community and please keep up the good track record!
MATLAB Central Team
MATLAB Onramp is a free online tutorial and it has been very popular with new MATLAB users to learn how to use it, and MathWorks have been adding more and more modules. The lastest one just dropped https://matlabacademy.mathworks.com/details/power-systems-simulation-onramp/orps
It shows you the basics of power system simulation by modeling a simple microgrid. You will learn how to simulate and measure three-phase circuits, and how to evaluate algorithms like droop control and maximum power point tracking.
Thats the task:
Given a square cell array:
x = {'01', '56'; '234', '789'};
return a single character array:
y = '0123456789'
I wrote a code that passes Test 1 and 2 and one that passes Test 3 but I'm searching a condition so that the code for Test 3 runs when the cell array only contains letters and the one for Test 1 and 2 in every other case. Can somebody help me?
This is my code:
y = []
[a,b]=size(x)
%%TEST 3
delimiter=zeros(1,a)
delimiter(end)=1
delimiter=repmat(delimiter,1,b)
delimiter(end)=''
delimiter=string(delimiter)
y=[]
for i=1:a*b
y = string([y x(i)])
end
y=join(y,delimiter)
y=erase(y,'0')
y=regexprep(y,'1',' ')
%%TEST 1+2
for i=1:a*b
y = string([y x(i)])
y=join(y)
end
y=erase(y,' ' )
Here's a screenshot from 22 years ago. Thanks for building one of the best engineering and science communities together.
That's the question: Given four different positive numbers, a, b, c and d, provided in increasing order: a < b < c < d, find if any three of them comprise sides of a right-angled triangle. Return true if they do, otherwise return false .
I wrote this code but it doesn't pass test 7. I don't really understand why it isn't working. Can somebody help me?
function flag = isTherePythagoreanTriple(a, b, c, d)
a2=a^2
b2=b^2
c2=c^2
d2=d^2
format shortG
if a2+b2==c2
flag=true
else if a2+b2==d2
flag=true
else if a2+c2==d2
flag=true
else if c2+b2==d2
flag=true
else flag=false
end
end
end
end
end
That's the question:
The file cars.mat contains a table named cars with variables Model, MPG, Horsepower, Weight, and Acceleration for several classic cars.
Load the MAT-file. Given an integer N, calculate the output variable mpg.
Output mpg should contain the MPG of the top N lightest cars (by Weight) in a column vector.
I wrote this code and the resulting column vector has the right values but it doesn't pass the tests. What's wrong?
function mpg = sort_cars(N)
load cars.mat
sorted=sortrows(cars,4)
mpg = sorted(1:N,2)
end

Hello, an intern working at MathWorks is finishing up his program soon and he would like to interview some MATLAB users. He is looking for people who can give their perspective on the question:
"What makes MATLAB and Simulink special in comparison to other languages?"
Ultimately he plans to condense the answers into 15-second videos or sound bites.
If people are willing to participate but want more time to talk about their experience with MATLAB, he doesn't have time left for in-depth interviews but he can find someone else to take over the project.
Please send me an email via my profle if you are interested.
Yes, in my company that I own
35%
Yes, for someone else (or Univ.)
21%
Only for free, for charities
13%
Only in my charitable foundation
5%
No, I'd just play, travel, & relax
25%
15668 个投票